I am trying to set up virtual host in Apache2 with Ubuntu 14.04.
The contents of host1.com.conf
file are :
<VirtualHost *:80>
ServerAdmin admin@host1.com
ServerName host1.com
ServerAlias www.host1.com
DocumentRoot /var/www/host1.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
contents of
/etc/hosts
:127.0.0.1 localhost 127.0.1.1 chandni-X451CA 127.0.0.1 host1.com ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
contents of
/etc/apache2/sites-available/default-ssl
:<IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin admin@host1.com DocumentRoot /var/www/host1.com/public_html <Directory /var/www/host1.com/public_html> Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost> </IfModule>
disabled
000-default.conf
and enabledhost1.com
from the terminal :sudo a2dissite 000-default.conf && sudo a2ensite host1.com.conf
restarted apache:
sudo service apache2 restart
After doing all these,
- When I go to localhost page I get 403 Forbidden error.
- When I type my public IP address as URL, the page is not loaded
- When I navigate to host1.com, the page is not loaded.
What may be the possible reason? Can anyone please help??