Fix Laravel 404 and 403 - Laravel is a free and open source PHP framework that aims to support the development of web applications under the MVC Model-View-Controller structure. When you deploy Laravel on VPS using Directadmin with Nginx webserver, you may encounter 404 and 403 errors when accessing the website. In this article, we will show you how to fix this error.
- To own Cloud VPS SSD with Directadmin, you can refer to the HOSTVN Cloud VPS SSD packages that are provided here
Cause of error
Note: In this article we will only guide errors due to the virtual hosting, chmod configuration and the default that your code is completely normal without errors due to routes and auth.
According to Laravel's structure, all requests will go straight to the public directory, but the virtual hosting configuration of VPS will only point to the directory. public_html, this is the cause of 403 errors when implementing Laravel source code.
For 404 errors, the main reason is that Nginx differs from Apache, it does not use the .htaccess file, so when deploying Laravel on Nginx will lack the rewrite rules that lead to 404 errors.
How to fix Laravel 404 and 403 errors when using VPS Directadmin running Nginx
Step 1: From the admin interface, you access Custom HTTPD Configurations
Step 2: Click on the domain you want to edit vhost
Step 3: Add the following content to
- The first box you add the following content
|? DOCROOT = / home / hostvn / domains / hostvn.net / public_html / public |
Inside: hostvn is the user, hostvn.net is your domain name instead of your user and domain name. To be exact, you can copy the path at the bottom to paste and add / public for accuracy
- UMBRELLA CUSTOM3 You add the following content
try_files $ uri $ uri / /index.php?$args;
try_files $uri $uri/ /index.php?$args;
After adding you press the button Save to save
Step 4: Restart Nginx
To finish you will need to restart Nginx, you log into the VPS via SSH and run the command:
If you do not know how to use SSH, you can refer to the following article: Instructions for using PuTTY to SSH into VPS
Through this article, we have shown you how to fix Laravel 404 and 403 errors when deploying on VPS Directadmin using Nginx webserver. If you have any contributions you can leave a comment below.
In addition, you can also refer to other shared articles of HOSTVN here
- Reálném 3D FlipBook v2.12 - WordPress Plugin
- Instructions on how to create underlined text in Word - Knowledge sharing blog
- Installing and configuring Yoast Seo to optimize Seo for wordpress - Part 1 - HOSTVN Blog
- Placement most effective backlink page is located?
- Photos ABT Audi RS6 cars & interior Avant 2003