Software :: RHEL 5 Apache Name Based Virtual Host Not Working
Jun 16, 2011
I have setup apache webserver on RHEL5 working fine for months now. Next task is to add another domain name to the webserver using the same IP address. I have been trying to set up apache name based virtual host for the past several days without success. Each time I try elinks [URL] it went to the main page sales.example1.com. Main page sales.example1.com is on DNS but 2nd domain [URL] is not created on DNS yet. I just doing testing first on /etc/hosts.
I have tried googling, search forum, and read documentation. I have checked my httpd.conf file several times but there must be some simple step or config error that I might miss:
Apache version is 2.2.3. Output of my httpd.conf file:-
NameVirtualHost *:80
# Default Virtual Host
<VirtualHost *:80>
ServerName sales.example1.com
DocumentRoot /var/www/html
DirectoryIndex index.html index.shtml index.php
</VirtualHost>
<VirtualHost *:80>
ServerName www.exampletst.com
DocumentRoot /var/www/virtual/tours
ErrorLog /var/log/httpd/tours_error_log
CustomLog /var/log/httpd/tours_access_log common
DirectoryIndex index.html index.shtml
<Directory "/var/www/virtual/tours/">
Options Indexes FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I am having two domains. for ex: www.example1.com and www.example2.com. These two domains need to be hosted under one ip. Yes by configuring name based virtual host we can do that. But, my question is my first domain(www.example1.com) need to be hosted by Apache web server, and my second domain(www.example2.com) need to be hosted by Tomact. Is it possible to configure name based virtual host for a scenario like this.
i installed RHEL 6 as virtual host on one of the blades on HP enclosure. i set up network on eth0 and started it but i cannot even ping gateway from within this installation. i logged in as root. i set up everything such as IP, netmask, gateway, nameserver etc.
can not ping from host (RHEL 6) to RHEL 5 in (virtual)? I have stopped iptables on both machines. But still not able to ping from host machine to virtual.
apache virtual host to limit the concurrent connections of virtual hosts? Taking into account the host of each virtual user's home directory can also have more than one subdirectory, which should be restricted to a subdirectory. Is beyond the control of the operation of these sites in a subdirectory. Best local restrictions or limitations to the overall situation.
I am upgrading my server and I have a lot of sites. Since I cannot take my server down for a few days, maybe a week until I manage to migrate all the sites to the new machine, I figured I could migrate them one by one. After migrating one, I would somehow tunnel the requests of that name virtual host to my internal machine. When everything is migrated, I would then switch the machines, update ip's and stuff and everything will work just fine.
However I cannot seem to find a way to do this tunneling. is this at all possible? If not, what alternatives do I have?
Having trouble visualising how IP-Based Virtual Host (with SSL) would work. Here is my vhosts.conf file:
Code: #Define Name Virtal Host NameVirtualHost 10.10.0.54:80 #Used to replace the main server host. The log file will reside in /var/log/httpd/error_log
[Code]....
How will it work? I will need to forward port 443 to the 10.10.0.55 interface right? Without doing that, there is no way this is going to work... is there? And that means that I can't run more than 1 ip-based SSL virtual host on one machine because I can't forward 443 to two different interfaces.
Also, do I use internal ip address or external ip address in the <VirtualHost > tag? I only have one static public ip.
1) My Internet connection is COMCAST with a router box and one public IP address.2) My web server is Apache using 10.1.10.200 as its address.3) Now I want to add another host name (www.myhealth.com) on my server. I did DNS forwardin (with Godaddy) to my COMCAST static IP address.4) I also added (in my httpd.conf) a block for virtual hosting
I have 4 domains registered through godaddy. I have a dell poweredge box with one static IP hosted somewhere. I want the 4 domain to resolve to four different sites. I have already created 4 different sites in apache with four different aliases and has enabled it.
eg alias /a /var/www/a alias /b /var/www/b alias /c /var/www/c
I tried with godaddys forward with masking option. It works but I can't hide xx.xx.xx.xx/a in the links. Whats the best approach? One limitation is I cannot use the webhosts name servers. How do I set this up with name based virtual hosting? Do I setup a DNS server in the box?
I do have a dns host name for my box which is publicy accessible. Some my.ca.examplehost.net
I'm using Apache 2.2 to host multiple subdomains using a single SSL certificate (a wildcard certificate e.g. *.mydomain.com) and, yes, it works! Everything seems to be served correctly and the browsers are pretty happy.
And you can also have the non-SSL sites (virtual hosts on port 80) on the same IP. (That's covered elsewhere)
For those that want similar functionality here's my discovery...
My configuration is like this:
ssl.conf:
Code:
I would have to say that I don't believe that this will work if you are not using a wildcard SSL certificate and having anything other than subdomains under that wildcard.
It is somewhat limited in scenario where this is useful, but for a set of company websites that should be under SSL, this can be tremedously useful when you have a single IP.
I'm running XAMPP 1.7.2 on Ubuntu 8.10 (Linux dt19.im.local 2.6.27-14-generic #1 SMP Tue Aug 18 16:25:45 UTC 2009 i686 GNU/Linux) and am using the PHP 5.3.0 Apache module as standard. For one virtual host I'd like to use PHP 5.2.X as it is part of a project which has a lot of legacy code which is not compatible with PHP 5.3.0. The virtual host configuration block and the applicable directory directive are as follows -
Code:
Checking phpinfo() output on the above virtual host (or using the default virtual host directive and accessing it via http://localhost/[SNIP]/[SNIP]/phpinfo.php rather than [url] shows PHP 5.3.0 is running. After applying minor tweaks such as adding ScriptAlias or SetEnv options the problem persists. I've Googled for a good while and have checked the permissions and the like and tried the advice of other users (XAMPP or otherwise) either resulting in PHP 5.3.0 being used or a HTTP 400 bad request/invalid URI error. I've stuck with the configuration above as this is correct according to the PHP manual.
FYI cgi-bin/php-5.2.6 is a soft symbolic link to /opt/lampp/bin/php-5.2.6 (I've added the FollowSymLinks option to the cgi-bin directory directive in httpd.conf). I've tried installing php5-cgi from the Ubuntu repos and setting it up in a similar way, to no avail. I've also tried copying the executables into the cgi-bin directory, pointing the Action line directly to bin/php-5.2.6 and dropping the -c /opt/lampp/etc/php.ini-pre1.7.2 option in the Action line. I've even tried commenting out the LoadModule lines for PHP which results in a HTTP 400 bad request/invalid URI error. This demonstrates the fact that the PHP CGI use is being ignored.
I've checked httpd.conf and the extra/httpd-*.conf files and ensured all required includes are being loaded. I know that it's probably something stupid on my part which is causing this! Given that I've tried PHP CGI builds in the Ubuntu repos I don't think this is an XAMPP-specific issue.
One of our Apache servers, version 2.2.3, is running three virtual hosts on it. However, while two are accessible, gray.mgh.harvard.edu, www.plastimatch.org, the third, cmrol.mgh.harvard.edu cannot be reached by any remote host.
I am at a loss as to why this is occurring. To that end, I am including the httpd.conf file as an attachment in the hopes someone can see what I missed, and help correct this issue.
How do I define the default virtual host to be served on port 80?
I have different configuration files in /etc/httpd/conf.d/ that look more or less like this:
Plus I have the namevirtualhost:80 in httpd.conf
For some reason if I connect to port 80 using the IP address or an alias not defined anywhere in apache config, the first domain configured (first alphabetically a-to-z) answers the call.
Is there any way to overwride this and set a default site?
Basically I'd like to answer with the right configuration if a precise site pre-configured is called on port 80, but if not I would like to redirect to a "default site"
I installed apache server on my Fedora 12. Its showing the test page 127.0.0.1, but when I give the address 97.168.234.76 (0r www.chaalu-kam.com), it tells that the requested url could not be retrieved.
I have made the following additions to the /etc/httpd/conf/httpd.conf file
I am trying to set up an Apache2 virtual host to test sites I make from my own computer.
I used this guide to set up my LAMP and vHost, The LAMP stack seems to be working great, but I run into some problems when I try to set up a vHost
As described in the guide I
1. made a new directory in my home folder /home/[myname]/www/test.dev to put my site in (it currently contains a simple index.html file as a test).
2. In /etc/apache2/sites-available I copied the file "default" and renamed it "test.dev"
3. I edited the content of "test.dev" to look like this:
Code:
4. I enabled the site using the command "sudo a2ensite test.dev". I then restarted apache "sudo /etc/init.d/apache2 reload".
5. I edited the hosts file: "sudo gedit /etc/hosts" to look like this:
Code:
6. I restarted apache "sudo /etc/init.d/apache2 reload".
Now if I enter "http://test.dev" in my firefox's adress bar I just get the apache2 "It works!" site. What is going wrong to cause firefox to show the "It works!" page rather then my own test site?
I'm now configuring my web server to server different Virtual Hosts based on DNS name. Right now I store my files in /var/www per the default installation settings in Apache.
Questions: I want to change the Document Root to /home/username/public_html/example1.dyndns.org for the second virtual server. What do the permissions need to be in order for Apache to read the files in this location? Would it be best to force Apache to run as this new username instead of www-data?
My Virtual host setup will look something like this
I want to change the DocumentRoot as I am running a chrooted ProFTPd server and want to be able to update webserver files via FTP. I am running Ubuntu 8.04 LTS Server (CLI only).
I'm having some basic doubt! Consider 5 virtual domains has configured under a same server. I mean 5 different domains under same IP. Eg. mydomain1.com and mydomain2.com have IP 208.27.1.89. So when web browser request for mydomain1.com name server return IP address 208.27.1.89. Then browser contact IP 208.27.1.89 on port 80. Here comes my question how does apache know that the browser is looking for mydomain1.com not mydomain2.com. How apache differentiate the request for it's virtual hosts? By the way, what is a virtualhost ?
I'm trying to figure out why Apache is ignoring SSL Cipher statements when placed inside a Virtual Host. Specifically I'm trying to disable SSLv2 and only allow SSLv3 or TLSv1
In httpd-ssl.conf I have the following
Code:
And when I try and connect, I get the expected results.
Quote:
In my virtual host statement I have
Code:
The only difference between the two is the httpd-ssl.conf has -ALL in the CIPHER, and the virtual host entry has ALL. However if I try and change the ALL statement in the virtual host entry to -ALL I get the following error in my logs & get no content.
Quote:
Why it's not working in the virtual host statement? Unfortunately as many of you are probably aware it's impossible to gain PCI certification with SSLv2 enabled.
How to give mulitple virtual host in apache. I want to access all my sites with ip 192.168.1.125
For ex :if i want to access dpm.net it should have the ip 192.168.1.230 with port 80 & for persur.net it should have the same ip 192.168.1.230 with port 80
After restarting the apache servers.I am unable to run both the applications in a single time.
For that i gave Include /etc/apache2/sites-enabled/[^.#]* in apache2.conf. But still its not working.
I've created a virtual host and when I try to access it it displays the root of the Default Server. Running Fedora 11. This works fine in our Fedora 8, same configuration.
192.168.0.200 Default server is set to Listen 80 virtual server
I've set up a server running Ubuntu 10.10 (desktop) with apache. Problem is: When I try to configure multiple virtual hosts I can only access the first one. I'm sure that I'm missing something basic in my setup, but I cannot seem to figure out what.
What I want is simply two virtual hosts, one only available on the LAN where I can test my php files and one "live" available from the outside.
Heres what I've done:
Installed Apache2.2 Copy /etc/apache2/sites-available/default -> /etc/apache2/sites-available/dev Modified "dev" config DocumentRoot and Document to point to /var/www/dev Modified "dev" config VirtualHost to <VirtualHost *:1337> (port change right?) Modified "default" config DocumentRoot and Document to point to /var/www/live
[Code].....
Live works fine, but dev cannot connect (as if there is no server there).
But when I try to check for syntax errors tells me SSLRequire not allowed here I do not want to add SSLRequire on the main httpd.conf because I only want it for one virtual host. The rest of the virtual hosts do not need it.
I'm trying to install two instances of OCS Inventory on the same machine using virtual hosts in apache. The apache configuration for it is in it's own file and it works fine without any virtual host. If I add it apache refuses to start without giving any error message. I narrowed it down to some lines loading perl modules, and if I comment them away apache will start again. Some of the modules work, but some of the ones specific to OCS Inventory will not work. I can't understand what the difference is between loading it in a virtual host or not, it doesn't make any sense to me!
I've got an apache server running several virtual hosts. I have them separated by domain name, and they all come into the same IP address. I'm looking for a way to monitor the bandwidth that they use. The only feature that I'm really looking for is a breakdown of which domain is dishing out how much bandwidth.
blocks.com got three visitors this month. And spent 200kb in serving them. emus.net got fifteen. And spent 1mb in serving them. reverse.org got 4000. and spent 400mb in serving them.What I would like to see is a report, could be a web page could be a file. Ideally with graphs. Showing: 1. 2..... 3[400mb worth of dots]
1-blocks.com 2-emus.net 3-reverse.org
I don't need it to show me how many visitors or from where or anything like that. I am just looking for a side by side comparison of how much bandwidth each domain is using.Is there some application for this or something. Everything that I've found has been for information on a single site (awstat and friends can show me information for multiple sites, but as far as I know it won't show me information comparing them) I haven't found anything for nagios, but perhaps there is something out there for it, or a sneaky way to make a nice plugin that would do this.
In first place i am sorry about my horrible English. I want to make a web site with a virtual host of apache visible by all the computers connected to my networking. I put this in the end of the file "/etc/httpd/conf/httpd.conf"("192.168.1.194" is the IP address of my computer. The default gateway IP address is "192.168.1.1"):
[Code]...
It works if i go to "http://192.168.1.194/" with the browser of the computer with apache inside, but on the others PC of my networking this method don't work!
I'm not sure is this is possible or not, but what I would like to do is take my public address mydomain.com and configure a virtual host something.mydomain.com only instead of having the content on the same server I would like it to point to the IP of my virtual machine that is in my private network and display that page publicly. Does anyone know if this is possible, or how to do it? I have done this with port forwards, but would like them both to be on the same port.