Friday, June 5, 2015

Apache2: Configuring a local page with custom host name (Virtual Host)

1. Create a folder /wwww/domain
sudo mkdir -p /www/domain 

2. Change permissions
sudo chown 755 /www/domain sudo chown -R www-data:www-data /www/domain 

3. Edit Apache2 conf
sudo gedit /etc/apache2/apache2.conf Add these lines:
<VirtualHost *:80>
    # This first-listed virtual host is also the default for *:80
    DocumentRoot /www/domain

<Directory /www/domain/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

4. Add DNS line in /etc/hosts 

 5. Create index file
touch /wwww/domain/index.html add HTML code:

6. Open domain in browser.

No comments:

Post a Comment