VirtualHosts not working properly

I am running Ubuntu Gnome 14.04, I apt-get installed apache2, php and mysql. From there, localhost was working fine, running from the /var/www/html/ directory.

I created a new file, /etc/apache2/sites-available/laravel.example.conf, and mimicked the 000-default.conf file that already existed in that folder:

<VirtualHost *:80> ServerName laravel.example ServerAlias ServerAdmin DocumentRoot /var/www/sites/laravel.example ErrorLog ${APACHE_LOG_DIR}/laravel.example_error.log CustomLog ${APACHE_LOG_DIR}/laravel.example_access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

I created the folder at /var/www/sites/laravel.example, added in 127.0.0.1 laravel.example to /etc/hosts, ran a2ensite laravel.example.conf, restarted apache, but still just get Web page not available when I try load it. Any ideas?

4

2 Answers

You need to set ownership / permissions of the directories and files to e readable by www-data

Personally I use:

sudo chown -R root:www-data /var/www
chmod 750 /var/www/sites
chmod 750 /var/www/sites/sites/laravel.example
chmod 640 /var/www/sites/sites/

As mentioned in my comment, I fixed this issue by chowning the /var/www/ directory recursively to my current user, and chmodding the directory to 755, restarted and it seemed to be working, so hopefully this was the actual fix.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like