WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] NGINX: Can't Preview Posts (404 ERROR) (4 posts)

  1. c1chrisc1
    Member
    Posted 1 year ago #

    Hi,

    I'm having some issues with my WordPress setup. My server is using Nginx, Varnish, APC, and PHP-FPM. My permalinks all seem to work fine with the exception of previewing posts. For some odd reason, I get a 404 error page.

    Whenever I preview posts within WordPress it brings me to a link like: http://www.domain.com/?p=986&preview=true which comes up as Page Not Found. Yet for all my published posts, the permalinks seem to work fine. My blog is currently using the Post name (domain.com/sample-post/) permalink setting.

    Even when I change the permalinks to default I'm still available to view all the posts and pages in the default permalink setting(domain.com/?p=123). But still can't preview posts...

    I do have the try files in my setup:
    try_files $uri $uri/ /index.php?q=$uri&$args;

    Any suggestions on what it could be?

    Thanks

  2. Pothi
    Member
    Posted 1 year ago #

    Try...

    try_files $uri $uri/ /index.php?$args;

    If that doesn't solve the issue, either, then the preview requests don't reach WordPress. The error log (from Nginx / Varnish) may provide a clue, though.

    If Varnish doesn't listen on port 80, try removing / bypassing Varnish altogether.

    I hope this helps!

  3. c1chrisc1
    Member
    Posted 1 year ago #

    Thanks for the reply!

    I tried your try_files suggestion and unfortunately it still doesn't work. I'll try and remove Varnish and see if that solves it.

  4. c1chrisc1
    Member
    Posted 1 year ago #

    So I figured it out. It was my Varnish configuration that was giving me the problems. Once I fixed that, everything is working perfectly fine now.

    Thanks Pothi!

Topic Closed

This topic has been closed to new replies.

About this Topic