Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: VirtualHosts displaying the proper page title, not content |
|
Author |
|
sewerraccoon
Joined: 09 Feb 2011 Posts: 5
|
Posted: Wed 09 Feb '11 20:36 Post subject: VirtualHosts displaying the proper page title, not content |
|
|
I've been working on a server to prepare it for more than one website It will be hosting. I've got one domain name for the site that's already on it, and the domain name assigned to every machine in the school. Both of those names are forwarded to the machines single IP. When a new site is added, they'll take out another appropriate domain name for the site for us. I set one virtual host to host the page we already have set up, and to test the configuration out I made a simple HTML test page and assigned another virtual host to it. After a little bit of tweaking, I thought I had everything sussed out, but something strange started to happen. When I type in the name for the test site, I get the test site, that all works fine, but when I type in the name for the site we're already hosting, I get the proper title for the site (up in the browser title and the tab), but the content in the main window is that of the test site. I'm stumped. I checked all the sites files, i made sure that the virtual host was pointing to the correct document root, but couldn't find anything. Any input would be most appreciated. I don't have access to the machine right now, but I'll throw my virtual hosts config up in a post after this. |
|
Back to top |
|
sewerraccoon
Joined: 09 Feb 2011 Posts: 5
|
Posted: Wed 09 Feb '11 21:31 Post subject: Update: My VirtualHosts config file |
|
|
Ok, so here's the file that I'm using to define my VirtualHosts. My main apache config links to this file. I'm not sure if it matters, but the server is running Ubuntu 10.04. Just FYI
Code: |
NameVirtualHost [Correct IP]:80
###SEHS Robotics virtual host file###
<VirtualHost [Correct IP]:80>
ServerAdmin webmaster@localhost
ServerName [Domain1].org
ServerAlias [Domain1].org
#DocumentRoot /var/www/
DocumentRoot /home/sehsadmin/www/robotics
CustomLog /var/log/apache2/southroboticsorg.log combined
</VirtualHost>
<VirtualHost [Correct IP]:80>
ServerAdmin webmaster@localhost
ServerName [Domain2].edu
ServerAlias test.org
DocumentRoot /home/sehsadmin/www/test/
CustomLog /var/log/apache2/testorg.log combined
</VirtualHost>
|
|
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Wed 09 Feb '11 23:43 Post subject: |
|
|
In main conf file, what is the ServerName & DocumentRoot |
|
Back to top |
|
sewerraccoon
Joined: 09 Feb 2011 Posts: 5
|
Posted: Fri 11 Feb '11 18:23 Post subject: |
|
|
Ok, here's my main configuration file. I don't think i've modified much of anything in here, the defaults seemed to be good enough. Sorry about the length |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 11 Feb '11 21:00 Post subject: |
|
|
Ok, looks like the one I wanted was Include /etc/apache2/httpd.conf
In there should be ServerName & a Document root. It is my guess that you are falling into the usual trap as many have before and many will in the future, specifically, what ever those are needs to be the first vhost in the list. Typically a;
<VirtualHost *:80>
DocumentRoot /var/www/whatever
</VirtualHost>
Is enough to satisfy the requirement noted under "Main host goes away"
http://httpd.apache.org/docs/2.2/vhosts/name-based.html |
|
Back to top |
|
sewerraccoon
Joined: 09 Feb 2011 Posts: 5
|
Posted: Mon 14 Feb '11 19:22 Post subject: |
|
|
well, because of Ubuntu's different apache installation, there's nothing in that httpd.conf file. the I may be better off asking at Ubuntu's forums. The initial file I uploaded was "apache2.conf", which is the main config file in ubuntu. It then includes several smaller config files to configure different stuff. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 14 Feb '11 22:33 Post subject: |
|
|
the main vhost config file is /etc/apache2/sites-available/default |
|
Back to top |
|
sewerraccoon
Joined: 09 Feb 2011 Posts: 5
|
Posted: Wed 16 Feb '11 19:57 Post subject: |
|
|
Yeah, I do have the "default" vhost file in sites-available, but I also have my customized vhost file there too, which I then made a symlink to, which is located in the sites-enabled directory, as per Ubuntu's MO |
|
Back to top |
|
|
|
|
|
|