3

I have a development web server (ubuntu + apache) that can be accessed via the url glacialsummit.com. For some reason, http://www.glacialsummit.com serves pages from the /srv/www/glacialsummit.com/ directory, but http://glacialsummit.com serves pages from the /var/www/ directory. Here's what some of my virtualhost config files look like

filename: /etc/apache2/sites-enabled/glacialsummit.com

<VirtualHost 97.107.140.47:80> ServerAdmin [email protected] ServerName glacialsummit.com ServerAlias www.glacialsummit.com DocumentRoot /srv/www/glacialsummit.com/public_html/ ErrorLog /srv/www/glacialsummit.com/logs/error.log CustomLog /srv/www/glacialsummit.com/logs/access.log combined </VirtualHost> <VirtualHost 97.107.140.47:443> ServerAdmin [email protected] ServerName glacialsummit.com ServerAlias www.glacialsummit.com DocumentRoot /srv/www/glacialsummit.com/public_html/ ErrorLog /srv/www/glacialsummit.com/logs/error.log CustomLog /srv/www/glacialsummit.com/logs/access.log combined SSLEngine on SSLCertificateFile /etc/ssl/localcerts/www.glacialsummit.com.crt SSLCertificateKeyFile /etc/ssl/localcerts/www.glacialsummit.com.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 </VirtualHost> <VirtualHost 97.107.140.47:80> ServerAdmin [email protected] ServerName project.glacialsummit.com ServerAlias www.project.glacialsummit.com DocumentRoot /srv/www/project.glacialsummit.com/public_html/ ErrorLog /srv/www/project.glacialsummit.com/logs/error.log CustomLog /srv/www/project.glacialsummit.com/logs/access.log combined </VirtualHost> ## i have many other vhosts that work fine in this file 

filename /etc/apache2/sites-enabled/000-default

<VirtualHost 97.107.140.47:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> 

filename: /etc/apache2/ports.conf

NameVirtualHost 97.107.140.47:80 Listen 80 <IfModule mod_ssl.c> # SSL name based virtual hosts are not yet supported, therefore no # NameVirtualHost statement here Listen 443 </IfModule> 

How do I make http://glacialsummit.com serve web pages from /srv/www/glacialsummit.com/public_html just like http://www.glacialsummit.com?

3
  • Posting (and reading!) the output of httpd -S will give you some clues as to the nature of your configuration problem. Commented Apr 18, 2010 at 14:32
  • i tried to run httpd, but got a command not found. i tried apt-get install httpd but go a "Package httpd has no installation candidate". What library do i need to install use this command? Commented Apr 18, 2010 at 16:18
  • It varies depending on distro; on my Debian install the command is: apache2ctl -S Commented Apr 18, 2010 at 22:30

3 Answers 3

5

What is the server name of the entire server, outside of any VirtualHosts? I'll bet it's glacialsummit.com... If so, then that becomes the ServerName for the unnamed VirtualHost in 000-default.conf, and this VirtualHost overrides the www.glacialsummit.com VirtualHost.

3
  • Confirmed!!! I looked in my /etc/hosts and saw the line "97.107.140.47 glacialsummit.com sovereign". I changed that line to "97.107.140.47 somethingelse.com sovereign", restarted apache and now glacialsummit.com serves pages from the same place as www.glacialsummit.com! Commented Apr 18, 2010 at 16:25
  • Glad I could help. It's often recommended to use a hostname that's different from any websites hosted by Apache, unless the IP will not have any VirtualHosts. So something.glacialsummit.com rather than just glacialsummit.com Commented Apr 18, 2010 at 19:45
  • Legend Josh. Spent quite some time to come to this answer. Some mail configuration for sending your own mail suggests your hostname should be the same as the domain...this was my issue too. Commented May 1, 2017 at 8:47
2
ServerAlias *.glacialsummit.com 

makes everything, (www, non-www, and subdomains ) fault to the alias.

0

Under your ServerAlias for your top-most virtualhost, add glacialsummit.com along with www.glacialsummit.com

1
  • I just tried it, reloaded apache, but still the same problem Commented Apr 17, 2010 at 16:57

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.