I'm working on moving applications from the old server to the new server and have to re-install. At this stage I configure PHP-based applications with related frameworks using Nginx as a web server. The problem that arises is the message Not Found with code 404, when the application runs the index.php file which then calls another file to run the actual process.
Next I created a test.php file to detect errors in the application and the tes.php file can run normally (code 200).
Information from curl shows the index.php file Found (302), but controller and action Not Found (404).
The results of sudo tail -f /var/log/nginx/error.log and sudo tail -f /var/log/nginx/access.log don't show anything odd. The php files have been processed correctly, but the problem lies most likely in my Nginx configuration which is not suitable for processing php files.
I changed the configuration in the file /etc/nginx/sites-available/myweb.domain.com, which is from
location / {
try_files $uri $uri/ =404;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
Then do sudo service nginx restart and check the result:
As a result, my applications can run as they should and the status becomes HTTP/1.1 200 OK or request has succeeded.
Tidak ada komentar:
Posting Komentar