Hello @Jency Jacob,
The NGINX isn’t correctly serving WordPress site. This is caused by one of the following issues:
- NGINX isn’t not installed WordPress in (
/home/site/wwwroot
). - Missing or incorrect configuration in
default.conf
. - PHP files are not being processed correctly by PHP-FPM.
Here’s how to fix it:
Update NGINX Configuration
Connect to your App Service via SSH:
https://yoursite.scm.azurewebsites.net/webssh/host
Copy the existing NGINX config for editing:
cp /etc/nginx/conf.d/default.conf /home/dev/default.conf
Open /home/dev/default.conf
in a text editor and replace its contents with:
server {
listen 80;
server_name mysite.azurewebsites.net;
root /home/site/wwwroot;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
error_page 404 /index.php;
}
Apply the Configuration via a Startup Script
nano /home/dev/startup.sh
Add the following content:
echo "Copying custom default.conf over to /etc/nginx/conf.d/default.conf"
cp /home/dev/default.conf /etc/nginx/conf.d/default.conf
nginx -s reload
chmod +x /home/dev/startup.sh
Run the following command to reload NGINX with the new configuration:
nginx -s reload
Alternatively, restart the App Service from the Azure Portal.
If you're still getting a 404 error, check for errors in the logs:
For more details refer this DOC for NGINX’s configuration when using Wordpress on App Service.
Hope this helps!
If you found this answer helpful, please click Accept Answer and consider upvoting it /click yes.
If you have any further questions, please click Comment.