I recently moved my wordpress site from one host to another. Previously i used Apache to run wordpress, but later on configured with nginx by following this tutorial How to Install WordPress with nginx on Ubuntu 12.04.
Everything works fine, but when i try to preview a new post from the admin panel it is showing not found error. But all already published posts are working fine.
When i click on preview post it is showing me url like
http://mydomain.com/?p=2671&preview=true but the page is 404.
The page title has Nothing found for ?p=2671&preview=true
My nginx configuration is:
server {
listen 127.0.0.1:8080;
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www/mysite/public;
index index.php index.html index.htm;
server_name mydomain.com;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
deny all;
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
location ~ .php$ {
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
I also have installed All In One SEO Pack plugin and from my admin i enabled permalinks to this format /%year%/%monthnum%/%postname%/
I searched lot of forums but still couldn’t find the exact solution. Kindly help me on this.
Thank You
Finally found the answer. It is the problem with Varnish configuration, it is not allowing to create a cookie.
Open the varnish configuration. In my case the file is at
/etc/varnish/default.vcl
and add the following lineand restart the nginx and varnish
I’ve tried to reproduce your issue on Ubuntu 12.04+nginx+php-fpm but without effect. It means that previewing works as expected. The only difference is I’ve uncommented line fast_cgi_pass 127.0.0.1:9000 and commented out the other one. As I see you’ve put ‘varnish’ in tags, so maybe it’s problem with varnish as suggested here -> http://wordpress.org/support/topic/nginx-cant-preview-posts-404-error
All i needed in my wordpress server is only 2 blocks
I don’t know about the SEO plugin, i use a different one.
Change :
to: