john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Apache httpd virtual hosts

UBUNTU APACHE EXAMPLE VIRTUAL HOSTS

/etc/apache2/sites-available/default

//this is all requests to this machine's port 80

ServerName  domain.com
ServerAlias www.domain.com
DocumentRoot /www/docs/host.foo.com

ErrorLog logs/host.foo.com-error_log        //ensure that the log files have the right permissions
TransferLog logs/host.foo.com-access_log    // chmod 644 host.foo...  chown apache:apache host.foo...

ErrorDocument 404 /messages/404.html        //custom error messages, file not found
ErrorDocument 500 /messages/500.html        //script fails to load

//just add a new virtualhost block for each new domain or subdomain that you want to host //just add another ServerAlias line for each name that you want a particular virtualhost //block to resolve

//now all the default apache stuff ServerAdmin webmaster@localhost ServerName fit-pc.co.uk Servera

    DocumentRoot /var/www/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

Virtual hosts allows multiple websites to be hosted on the same server differentiated by DNS names - not unique ip addresses


  • « windows command line logoff
  • apache httpd example httpd.conf »

Published

Apr 30, 2010

Category

linux

~144 words

Tags

  • apache 13
  • hosts 1
  • httpd 3
  • linux 249
  • virtual 10