1

I have a server with Ubuntu 14.04.1, Apache at port 8008 and nginx at port 80 as a proxy for Apache. It runs a website based on Wordpress.

I use Wordpress's plugin WP Super Cache with the following settings:

enter image description here

Also I use Permalinks like this:

enter image description here

When I had only Apache at port 80 (nginx was not installed back then), everything was working just fine.

But now (with Apache at 8008 and nginx at 80) the problem is: I can load only title page, like example.com, and other links like example.com/2015/05/16/somepost don't load and return back to the title page example.com.

Here's the nginx website config (/etc/nginx/sites-enabled/mysite):

server {
    listen 80;
    server_name example.com;
    root /var/www;
    index index.php;

    gzip on;
    gzip_disable "msie6";
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;

    location ~ /\. {
            deny all;
    }

    location ~* /(?:uploads|files)/.*\.php$ {
            deny all;
    }

    location ~* ^.+\.(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;
    }

    location / {
        try_files $uri $uri/ /index.php$args;
    }

    location ~ \.php$ {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8008;
    }
}

And that's /var/www/.htaccess:

# BEGIN WordPress

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

# END WordPress

What am I doing wrong? I tried the following advices:

But none of them helped.

By the way, http://example.com/wp-admin/ works anytime, so I guess the trouble is related to cache (WP Super Cache).

0

After a while researching and experimenting I've managed to find solution:

  1. Install plugin Permalink Fix & Disable Canonical Redirects Pack;
  2. Change the location / block in my config (the one I posted above) like that:
location / {
    try_files $uri $uri/ /index.php?q=$uri&$args;
}

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.