Mobile app version of vmapp.org
Login or Join
Murray432

: Wordpress, Apache and Nginx: permalinks and cache 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.

@Murray432

Posted in: #Apache #Nginx #Permalinks #Wordpress

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:



Also I use Permalinks like this:



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 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:

stackoverflow.com/questions/23936618/500-error-with-nginx-and-wordpress-pretty-permalinks https://stackoverflow.com/questions/17282963/wordpress-nginx-preview-post-is-404-not-found-but-old-posts-are-working stackoverflow.com/questions/27593466/plesk-nginx-wordpress-permanent-links-404-not-found-nginx

But none of them helped.

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

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray432

1 Comments

Sorted by latest first Latest Oldest Best

 

@Radia820

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


Install plugin Permalink Fix & Disable Canonical Redirects Pack;
Change the location / block in my config (the one I posted above) like that:



location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme