ubuntunginxdirectoryhttp-status-code-404vesta

How can 404 errors in requests to laravel dynamic subdirectory be fixed?


How can 404 errors in requests to laravel dynamic subdirectory be fixed?

Vesta cp creates a different directory to hold nginx web content than default nginx.

The different directory is: /home/user/web/somesite.com/public_html

The normal default nginx directory is: /var/www/somesite.com/html

The nginx configuration can be edited to change the root directory from public_html to the laravel root directory public, in this file: /home/user/conf/web/somesite.com.nginx.conf

However, even after doing this, the orchid dashboard subdirectory somesite.com/dashboard, which is dynamically created by laravel, results in 404:

Any help would be greatly appreciated.


Solution

  • Solution:

    Run nginx -T (uppercase T) // to list all of nginx configurations.

    Then set the correct root in the nginx.conf, ie: /home/user/web/example.com/public;

    To fix these 404s, add this to the /home/user/conf/web/example.com.nginx.conf:

    location / {
    
            try_files $uri $uri/ /index.php?$query_string;
    ...