Virtual host not working in Apache2 Ubuntu 14.04 after doing all steps


Answer: 1

31 hours ago

I am trying to make name based virtual hosts in Apache2 with Ubuntu 14.04, after doing all these step, I am redirected to localhost but not to the file on my virtual directory. What I already did;

  • set up vdc.local.conf file with

    <VirtualHost *:80>
    ServerName vdc.local
    ServerAlias www.vdc.local
    ServerAdmin webmaster@localhost
    DocumentRoot /media/luzan/Backup/Dropbox/vdc/vdc.local/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
  • changed hosts in /etc/hosts vdc.local
  • added this to apache2.conf in /etc/apache2/

    <Directory /media/luzan/Backup/Dropbox/vdc/vdc.local/public_html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
  • from terminal did

    sudo a2ensite vdc.local.conf
  • restarted apache2 using

    sudo service apache2 reload

After doing all this I am redirect to localhost page when i navigate to vdc.local in web browser.

Apache2 Ubuntu Default Page

I have login.html inside that vdc.local/public_html/ folder and again when I navigate to vdc.local/login.html, I getting 403 Forbidden Error.

Did all this did I missed anything there? I have a folder in that document root too.

Added by: Lauryn Kohler

Answer: 2

36 hours ago

The apache package comes with a default config in /etc/apache2/sites-enabled/, I think it's called 000_default.conf or something like that, which by default responds to any request on port 80, regardless of the hostname. Use sudo a2dissite to disable it and restart apache.

Added by: Cyrus Casper MD

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9