Ran into a 500 issue when running Nginx and WP together and setting pretty permalinks. I’ve been trying a bunch of different methods from Google but none seems to help.
Config –
server {
listen 80;
root /var/www/mydomain.com/public_html;
index index.php index.html index.htm;
server_name .mydomain.com;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
All files load perfectly well, and the pages work if using the default permalinks setting. Strange thing is, if I check the network log I first see a 200 OK being received, then immediately followed by a 500. Any ideas?
Edit: Setting to close as I’m switching to Apache instead. Will mark correct answer as it seems to have helped others.
try:
AND:
(note the / )
Also above answer by Rufinus is correct.
Here is correct . You Forget to define Index . So nginx don’t know which file to lockup and process. Hope this help u out.
Your Config does not have fastcgi_parm .
add this line to your config. Its main part of Nginx Config.
change /home/public_html with your website path location
Here is my Whole wordpress config file. I Hope that works. Its working Nginx config file with pretty urls.