Manasa
Manasa

Reputation: 187

Virtual host is not working in ubuntu 16.04 giving forbidden error

Just now i have installed a virtual host in /home/invensis/test_cakephp

 sudo mkdir -p /home/invensis/test_cakephp
sudo chown -R $USER:$USER /home/invensis/test_cakephp
sudo chmod -R 755 /home/invensis
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/test_cakephp.conf

I have changed the test_cakephp.conf like this.But the virtual host is working properly for other than test_cakephp

sudo nano /etc/apache2/sites-available/test_cakephp.conf
    <VirtualHost *:80>
     ServerName test_cakephp
     DocumentRoot /home/invensis/test_cakephp/
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

After this i have used

sudo service apache2 reload

And then i edited hosts by using

sudo nano /etc/hosts 

But when i run the localhost test_cakephp i am getting the errors like You don't have permission to access / on this server. Apache/2.4.18 (Ubuntu) Server at test_cakephp Port 80. You don't have permission to access /favicon.ico on this server. Apache/2.4.18 (Ubuntu) Server at test_cakephp Port 80.

I have tried this also.But this also not working for me. Options Indexes FollowSymLinks AllowOverride None Require all granted

Upvotes: 1

Views: 1278

Answers (1)

gmc
gmc

Reputation: 3990

Edit: DocumentRoot should be specified without a trailing slash:

DocumentRoot /home/invensis/test_cakephp

You have to enable the VirtualHost and then reload again:

sudo a2ensite test_cakephp
sudo service apache2 reload

If you want to disable it again:

sudo a2dissite test_cakephp
sudo service apache2 reload

Upvotes: 2

Related Questions