1

I have an Ubuntu server running Nginx, php-fpm, and wordpress in a subdirectory. My config looks like this:

server {
    #My site configuration
    location /blog {
            root /home/user/www;
            index index.php index.html index.htm;
            error_log       /var/log/blog_error.log;
            error_page 404 /blog/404.html;
            error_page 500 502 503 504 /blog/50x.html;
            location /blog/ {
                    try_files $uri $uri/ /blog/index.php?$args;
            }
            location = /blog/favicon.ico { log_not_found off; access_log off; }
            location = /blog/robots.txt { allow all; log_not_found off; access_log off; }
            location ~ /blog/\. { deny all; }
            location ~* /blog/(?:uploads|files)/.*\.php$ { deny all; }
            rewrite /blog/wp-admin$ $scheme://$host$uri/ permanent;
            if (!-e $request_filename) {
                    rewrite ^(.*)$ /blog/index.php?q=$1 last;
                    break;
            }
            location ~ \.php$ {
                    #try_files $uri =404;
                    fastcgi_split_path_info ^(/blog)(/.*)$;
                    fastcgi_index blog/index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
            }
            location ~* ^.+\.(css|js|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
                    access_log off; log_not_found off; expires max;
            }
    }
}

With a fresh WP installation version 3.7.1, I get Invalid post type when I click on the Posts link in my dashboard.

http://i.stack.imgur.com/oExqD.png

And when I click on Add New Post I get the new post page but the right sidebar which should contain the Post button and other controls shows empty.

http://i.stack.imgur.com/kPEfs.png

I'm sure it has got to do something with my configuration, because I'm trying with a fresh DB and a fresh WP.

Any ideas?

Thanks.

migrated from serverfault.com Dec 10 '13 at 16:14

This question came from our site for system and network administrators.

  • What plugins did you install? – Michael Hampton Dec 10 '13 at 8:01
  • No plugins at all, fresh installation. – mpcabd Dec 10 '13 at 10:37
  • I know of no reason why your nginx configuration should cause these problems, and I don't see any serious problems in it. The cause of these problems almost certainly lies elsewhere. – Michael Hampton Dec 10 '13 at 16:12
  • I tried a subdomain configuration instead of a subdirectory and it worked flawlessly, the same WP and DB, no changes, only to nginx! This is driving me crazy. – mpcabd Dec 15 '13 at 5:56
  • Wait a minute, are you trying to run multisite in a subdirectory? I don't think you can do that. – Michael Hampton Dec 15 '13 at 6:00
1

The issue was solved by commenting out this line

fastcgi_split_path_info ^(/blog)(/.*)$;

It solved the issue, with apparently no side effects. I got the answer on Wordpress.org forums which was originally posted on nginx forums

Cheers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.