virtual host apache linux code example
Example 1: virtual host apache
<VirtualHost *:80>
ServerName domain1.com
ServerAlias www.domain1.com
ServerAdmin [email protected]
DirectoryIndex index.html
DocumentRoot /home/demo/public_html/domain1.com/public
LogLevel warn
ErrorLog /var/log/apache2/error-mydomainname.com.log
CustomLog /var/log/apache2/access-mydomainname.com.log combined
</VirtualHost>
sudo a2ensite domain1.com
sudo /etc/init.d/apache2 reload
Example 2: apache virtual host
<VirtualHost *:80>
ServerName domain1.com
ServerAlias www.domain1.com
ServerAdmin [email protected]
DirectoryIndex index.html
DocumentRoot /home/demo/public_html/domain1.com/public
LogLevel warn
ErrorLog /var/log/apache2/error-mydomainname.com.log
CustomLog /var/log/apache2/access-mydomainname.com.log combined
</VirtualHost>
sudo a2ensite domain1.com
sudo /etc/init.d/apache2 reload