User Tools

Site Tools


apache_vhost_ubuntu

Configuring (all distributions)



Default configuration file: /etc/apache2/sites-available/
You will need to create a vhost in this directory, with the file ending in .conf.

For example:
/etc/apache2/sites-available/example.com.conf

Example vhost for apache

<VirtualHost *:80>
    ServerAdmin [email protected]

    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/vhosts/example.com

    <Directory /var/www/vhosts/example.com>
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog logs/example.com-error_log
    CustomLog logs/example.com-access_log common
</VirtualHost>


Reloading Apache Configuration

Once the vhost has been created you will need to enable the vhost using a sym-link and then reload apache for the configuration to take effect:

sudo a2ensite example.com.conf
service httpd reload

apache_vhost_ubuntu.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki