Making Wordpress Plugins Work With Nginx

I’m new to Nginx (Moving from Apache). I’m having a problem where the
majority of Wordpress plugin are not working. I’m using Nginx 1.1.3.

Here are my configuration if it can help figuring out the problem

####nginx.conf
user www-data;
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
# multi_accept on;
}

http {
include /etc/nginx/mime.types;

access_log  /var/log/nginx/access.log;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
tcp_nodelay        on;

gzip  on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

}

####sites-available/mydomain.com

server {
listen 80;
server_name mydomain.com;

    access_log  /var/log/nginx/mydomain.com.access.log;
    root   /var/www/mydomain;
    index  index.php;

    location / {
            try_files $uri $uri/ @wordpress;
    }

    location @wordpress {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME

/var/www/mydomain/index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_NAME /index.php;
}

    location ~ \.php$ {
            try_files $uri @wordpress;
            fastcgi_pass    127.0.0.1:9000;
            fastcgi_index   index.php;
            fastcgi_param SCRIPT_FILENAME

/var/www/mydomain$fastcgi_script_name;
include fastcgi_params;

Thanks

Posted at Nginx Forum:

Hi,

Nginx does not embed PHP into its own process like Apache does, this
mean that Nginx has no effect on the execution of PHP and if word press
plugins do not work then it’s either due to the plugins relying on
Apache via mod_rewrite or because you have misconfigured PHP.

If it’s a mod_rewrite problem then we can potentially help, but we’ll
need to know what it expects from .htaccess, if it’s the latter then
this is probably the wrong mailing list.

Posted at Nginx Forum:

Thank you Ensiferous.

I don’t think it’s a PHP issue because Wordpress itself works fine it is
quite possible though that it’s a mod_rewrite issue. I’m not familiar
with Nginx access rewrite my .htaccess is really basic

BEGIN WordPress

RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

END WordPress

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www.)?mydomain.com/ [NC]
RewriteCond %{HTTP_REFERER} ^http:// [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .(jpe?g|gif|png)$ - [F]

Thanks again for the help

Posted at Nginx Forum:

try installing this plugin when WP detects nginx and “not compilant”
SAPI it assumes that rewrite is impossible and turns it off,
this plugins works around that problem. (but do not use it with Apache
if you move your WP somewhere else later)

~ cheers

Posted at Nginx Forum: