dpak005
dpak005

Reputation: 241

Setting the Root to public folder in laravel @Apache2 Server Ubuntu 14.04 LTS

I have the following configuration and yet i am not able to access Laravel directly.

in /etc/apache2/sites-available/laravel.conf

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/laravel/public
        <Directory /var/www/html/laravel/public>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

the following appears:

enter image description here

Any help would be highly appreciated. Thanks in advance.

Upvotes: 2

Views: 7748

Answers (1)

RafaelM
RafaelM

Reputation: 128

You must to change in your /etc/apache2/sites-enabled/laravel.conf file the directory to the public path. Like this:

<VirtualHost your-ip-address:80>



ServerAdmin [email protected]
ServerName localhost
ServerAlias your-url
DocumentRoot /var/www/html/laravel/public

<Directory "/var/www/html/laravel/public">

    AllowOverride All
        Options FollowSymLinks Indexes
        Order allow,deny
        Allow from all

</Directory>


ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined


</VirtualHost>

You should also check the permissions of the directories. Most folders should be normal "755" and files, "644". Of course, your vendor folder must be avaible to install any update.

Remember that the apache user is www-data.

This is an example that makes the apache application work on laravel bootstrap cache:

sudo chgrp -R www-data storage bootstrap/cache

sudo chmod -R ug+rwx storage bootstrap/cache

Upvotes: 4

Related Questions