I have configured apache with mod_jk, to redirect the /taste context to my application server. Now I would like to create a virtual host, so that my domain name redirects to this context.
I tried the following configuration in httpd.conf :
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.suitmytaste.com
ServerAlias suitmytaste.com *.suitmytaste.com
DocumentRoot /taste
</VirtualHost>
But apache does not accept the /taste part as a DocumentRoot. How can I configure it so it redirects the virtual host to the mod_jk connector?
I made it work by removing the DocumentRoot line, and adding the following lines instead :
JkMount / worker1
JkMount /* worker1
with worker1 being the worker I had configured in mod_jk worker.properties file.
Related
As apache doc said:
The first VirtualHost section is used for all requests that do not
match a ServerName or ServerAlias in any <VirtualHost> block.
How to understand this sentence?
If my configuration like this(assume that hostname test.com is valid):
<VirtualHost *>
DocumentRoot "/www/test"
ServerName a.test.com
</VirtualHost>
When I visit b.test.com, apache will use The first VirtualHost section,But it could not resolve host.
I would like my two sites: flowers.loc (Drupal 8) and honey.loc (Drupal 7) sites to work locally on Apache (v: 2.234).
First directory for flowers.loc:
Sites/drupal8/docroot
Second directory for honey.loc:
Sites/drupal7/docroot
I have this setting in httpd, apache configuration file:
<VirtualHost *:80>
DirectoryIndex index.html index.php
DocumentRoot /User/Vizzaro/Sites
<Directory "/User/Vizzaro/Sites">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Have a look at https://httpd.apache.org/docs/2.2/vhosts/examples.html to find out how to set up virtual hosts. Your configuration file has only one virtual host entry but you need one entry for each site. And furthermore your config is missing the ServerName. Try this: (untested)
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
ServerName flowers.loc
DocumentRoot /User/Vizzaro/Sites/drupal8/docroot
# Other directives here
</VirtualHost>
<VirtualHost *:80>
ServerName honey.loc
DocumentRoot /User/Vizzaro/Sites/drupal7/docroot
# Other directives here
</VirtualHost>
And be sure that honey.loc and flowers.loc both point to the IP of the machine on wich your apache is running. Try ping flowers.loc - if this results in an error like Name or service not known you probably have to edit your hosts file to fix it.
Is it possible to configure my URL which has my IP address on it- like: "http://192.168.xx.yy/index.php". The situation is when I run Apache server in my PC, and load localhost in it. I know it is possible after hosting with external server, but is there any way we can configure within our localhost?
How to configure the Apache files to make this happen? I tried in my localhost, editing the "httpd.conf" by adding this inside like this - please tell me where I am getting the issue!
ServerName localhost:80
HostnameLookups Off
<VirtualHost *:80>
# This first-listed virtual host is also the default for *:80
ServerName www.example.com
ServerAlias example.com
DocumentRoot /www/domain
</VirtualHost>
<VirtualHost *:80>
ServerName other.example.com
DocumentRoot /www/otherdomain
</VirtualHost>
DocumentRoot "c:/wamp/www/"
Yes, you can play with multiple IP addresses on your machine. Configuration depends on your OS. Article Create Multiple IP Addresses to One Single Network Interface is for linux.
But, better way is to use VirtualHosts based on host names or (simplest) on ports. So you can get http://siteA.mycoputer.localhost, http://siteB.mycomputer.localhost in the first case and http://192.168.x.y:8000, http://192.168.x.y:9000 in the second case
Here is Apache Server config example from Apache Server 2.2 documentation
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example.org
# Other directives here
</VirtualHost>
I have a Pentaho website on a server, listening on port 8080.
I have, also, an Apache Webserver listening on port 80, and here it is the problem: pentaho should be reachable via the domain pentaho.domain.com, and on one Apache virtualhost is configured like this:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName pentaho.domain.com
ServerAlias pentaho
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
If I access via pentaho.domain.com the first time is working without problems (I can login), but after that it redirects to localhost:8080 (which is wrong). What am I missing?
thank you.
You need to use JkMount.
<VirtualHost *:80>
ServerName reports.xx.com
ServerAlias reports.xx.com
JkMount /pentaho workeresb
JkMount /pentaho/* workeresb
JkMount /pentaho-style workeresb
JkMount /pentaho-style/* workeresb
</VirtualHost>
And in separate file define ajp properties:
worker.list=workeresb
worker.workeresb.type=ajp13
worker.workeresb.host=blade2
worker.workeresb.port=8009
worker.workeresb.lbfactor=50
worker.workeresb.cachesize=10
worker.workeresb.cache_timeout=600
worker.workeresb.socket_keepalive=1
worker.workeresb.socket_timeout=300
I have a server running Apache 2.4 on Windows, and I have set up a VirtualHost in the httpd-vhosts.conf file, and an 'A' record in my DNS server that points subdomain.mydomain.com to my IP address. Unfortunately, connecting to subdomain.mydomain.com just shows the same page as mydomain.com. Here is the code I used in the httpd-vhosts.conf file:
<VirtualHost *:80>
ServerAdmin admin#mydomain.com
DocumentRoot "c:/Apache24/subdomain/htdocs"
ServerName subdomain.mydomain.com
ErrorLog "c:/Apache24/subdomain/logs/errors.log"
CustomLog "c:/Apache24/subdomain/logs/access.log"
</VirtualHost>
What am I doing wrong?
Make sure your domain provider configuration doesn't redirect # to www, you need them to be configured separately to redirect to your machines IP address