How to fix nginx 404 error while accessing the site . I already tried the given solution in the document.

Durgesh Pandey 0 Reputation points
2024-09-20T12:28:16.5066667+00:00

This is the attached file.image_2024_09_20T12_22_03_795Z.png

I just changed the below data in for nginx configUser's image

image_2024_09_20T12_22_03_795Z

image_2024_09_20T04_07_19_812Z

cp /etc/nginx/sites-enabled/default /home/default


vi /home/default


cp /home/default /etc/nginx/sites-enabled/default; service nginx start
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,782 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 26,216 Reputation points Microsoft Employee
    2024-09-24T18:58:54.02+00:00

    Durgesh Pandey , Apologies for the delayed response. Based on my understanding of your issue description, I see that you have already tried multiple things to isolate the issue, just to highlight some common causes of 404 errors, such as incorrect URL paths, misconfigured NGINX settings, and issues with PHP file handling. What app framework are you leveraging? -NGINX may show a 404 while application logging indicates a HTTP 5xx was actually returned.

    Ultimately, this is due to the fact that the error_page directive in NGINX’s default.conf returns a non existent /50x.html when HTTP 5xx’s are returned. Please check this - PHP configuration: Customizing NGINX’s error page handling

    -Please confirm if npm run build or yarn run build is expected to be ran - or if the production build folder is set in a .gitignore.

    • For example, using Oryx as a deployment method - a custom deployment script may be needed - see Oryx - Configuration and POST_BUILD_COMMAND or POST_BUILD_SCRIPT_PATH

    I see that you have highlighted config details in the screenshot, juts to confirm - A common theme is with frameworks again - such as Laravel and Yii - where the application is served out of /public/ or /web/ - which would equate to /home/site/wwwwroot/public or /home/site/wwwroot/web - whereas NGINX’s default root is /home/site/wwwroot.

    Kindly enable App Service Logging and then review application logs to fetch more info.

    Please let us know, I'll follow-up with you further.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.