0

I've created a Laravel Project, which I have deployed previously with apache2, and working great.

As I finished with my latest deployment, I found that no external CSS was being loaded when I was done with. So I did a check on all step many times over, but I don't think I have missed on anything.

However, upon running with php artisan serve everything works fine.

Here is my virtual_host config file:

<VirtualHost *:80>
    ServerAdmin admin@project
    DocumentRoot /var/www/html/project/public/index.php
    ServerName example.com
    ServerAlias www.example.com
    DirectoryIndex index.php

    <Directory /var/www/html/project/public>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
7
  • Did you try hard reload with ctrl+shift+R ? Commented Oct 29, 2018 at 10:43
  • yes..tried everything with reload, emptied cache also. Nothing worked. Commented Oct 29, 2018 at 10:44
  • You have set your DocumentRoot to the index.php file. You should set it to the folder instead. So it should be DocumentRoot /var/www/html/project/public Commented Oct 29, 2018 at 10:46
  • Ok. I'll check it @MrPixelDream Commented Oct 29, 2018 at 10:47
  • 1
    in console check what error you are getting while loading css and js files Commented Oct 29, 2018 at 10:47

1 Answer 1

1

In virtualhost configuration, you should try using

<VirtualHost *:80>
    ServerAdmin admin@project
    DocumentRoot /var/www/html/project/public
    ServerName example.com
    ServerAlias www.example.com
    DirectoryIndex index.php

    <Directory /var/www/html/project/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

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

Remove public folder from <Directory> and also remove index.php from DocumentRoot.

Sign up to request clarification or add additional context in comments.

1 Comment

DocumentRoot I understand, but why do I need to remove public from directory? This worked tho :|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.