Virtual Hosting of Multiple Domains with Apache ----------------------------------------------- 2005-07-17 NameVirtualHost my.ipa.ddr.ess ServerAdmin username at example dot com ServerName www.example.com ServerAlias example.com DocumentRoot /var/www/html/example.com/ Order deny,allow Deny from all Allow from 10.1.1.0/24 #allow /usage from internal net only CustomLog /var/logs/something.log combined #access-log NOTE: see webalizer_virtualhost.txt for more on setting up multiple domains HTTP to HTTPS redirection to another site: ServerName foo.example.com RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*) https://www.example2.com$1 [R,L] HTTP to HTTPS redirection to same site just change this line: RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L] just add more of these for each website! Setup Username folders (/~myuser/) from web root --------------------------------------------------- 1. Goto /home and change permissions on the user's dir chmod 711 2. Goto /home/ and create public_html dir mkdir public_html 3. Change permissions on public_html dir chmod 755 public_html 4. User can now create index.htm or index.html and begin building their site. Setup folders for browsing contents ----------------------------------- # # This is for directories that require browsing. # # # Options Indexes FollowSymLinks # Setup for SSL (when you have multiple websites hosted on same machine) ---------------------------------------------------------------------- 1. Only works for first VirtualHost (the default) NameVirtualHost [local IP address] and then later down the file: (summary of the directive, full is above) www.example.com 2. in /etc/httpd/conf.d/ssl.conf change ?? to ?? 3. might need 2 NameVirtualHost lines: NameVirtualHost *:80 NameVirtualHost *:443 ** NOTE to self, 1/7/2004 SSL currently works for https://localhost only. Why not www.example.com? **