On Sat, Nov 3, 2012 at 8:31 AM, <[email protected]> wrote: > > > On Friday, November 2, 2012 21:48, "Wolf Halton" <[email protected]> said: > >> Make these changes in sites-available files. That is what those files in >> there are for. >> I don't have the specific directive but I can put up one of my servers' >> apache files for you. >> >> Wolf Halton >> http://sourcefreedom.com >> Apache developer: >> [email protected] > > Thanks Wolf, and it makes sense that the directives that apply to a site would > go in that site's definition. I just don't quite understand what I need to put > in there. When I check the default site access logs, I see the request for > http://domain1.com come in as /, but I also see the same for domain2.com and > for the IP address. All three show up as "GET / HTTP/1.1" I understand that > the > server does not know about the sites by those names because I haven't > configured it to do so. > > Obviously Apache is capable of this distinction because if I change the > ServerName in domain1's sites-available to domain1.com then the index.html > file > in /var/www/htdocs/domain1.com is returned to the client. If I add the > ServerAlias www.domain1.com directive then both the request for domain1.com > and > the request for www.domain1.com return /var/www/htdocs/domain1.com/index.html, > but the URL does not change in the navigation bar, and both show up in the log > as "GET / HTTP/1.1". > > I know I've entered URL's into my browser's navigation bar and watched them > change to something else, such as entering http://example.com and being > redirected to http://www.example.com, with that URL then populating the > navigation bar. So I'm close in that both requests return the file that I > want returned, but I don't know how to have the URL change so the user sees > the URL I want them to see. > > So I guess what I'm asking is, how do I configure things so that the server > knows a request for domain1.com should be handled as if it were a request for > www.domain1.com, and sends the client to that URL? > > Thanks, > Craig > > > Sent - Gtek Web Mail > >
Here are the settings for one of my multisite servers. I am using Apache2.2 on Debian Squeeze with the backports repo enabled - thus it is not a stock Squeeze install This is even simpler than I thought I would be giving you as the NameVirtualHost directive is in conf.d/virtual.conf If you notice, the apache2.conf file has only the generic server info and all of the specific user configs are in other places. It handles the "did they type www. or not in the virtual config as a server alias. This is not a redirect, which would add details to the url, like you get when you type http://evergreen.lyrasistechnology.org into the address bar, because these 2 directories are simply not shared. The evergreen address is pointed at a directory outside of /var/www and can be shared by multiple clients and the search scope is different in each. ** You may get a warning when you restart apache with this setup because default-ssl is listening on port 443 - the complaint will be that apache does not like mixing virtual servers with port numbers and others without. I haven't had to restart this setup for months, so I don't remember the exact warning message. -Wolf #=======snippet from apache2.conf # Include generic snippets of statements Include conf.d/ #=======Contents of conf.d directory======================= wolf@SERVER-01:/etc/apache2/conf.d$ ls charset localized-error-pages other-vhosts-access-log security virtual.conf #=======Configuration of virtual.conf======================= wolf@SERVER-01:/etc/apache2/conf.d$ cat virtual.conf # running virtual hosts # NameVirtualHost * #======Contents of the sites-available directory============ wolf@SERVER-01:/etc/apache2/sites-available$ ls default default-ssl legacy #======Configuration for dev.example.net==================== wolf@SERVER-01:/etc/apache2/sites-available$ cat default <VirtualHost *> ServerAdmin [email protected] ServerName dev.example.net ServerAlias www.dev.example.net DocumentRoot /var/www/http/ <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/http/> 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> </VirtualHost> #========Configuration for legacy.example.net====================== wolf@SERVER-01:/etc/apache2/sites-available$ cat legacy # This is the settings file for the legacy.example.net site <VirtualHost *> ServerAdmin [email protected] ServerName www.legacy.example.net ServerAlias legacy.example.net # Indexes + Directory Root. DirectoryIndex index.html DocumentRoot /var/www/legacy/htdocs/ # CGI Directory ScriptAlias /cgi-bin/ /var/www/legacy/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> # Logfiles ErrorLog /var/www/legacy/logs/error.log CustomLog /var/www/legacy/logs/access.log combined </VirtualHost> -- This Apt Has Super Cow Powers - http://sourcefreedom.com Open-Source Software in Libraries - http://FOSS4Lib.org Advancing Libraries Together - http://LYRASIS.org Apache Open Office Developer [email protected] -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/CALRLYEmYvqzFFSidNhv5V+ka0YQr7A-6FK3u-=s0aph1-0k...@mail.gmail.com

