0

I'm running a wp-blog on LEMP stack, I'm setting permalink fro WP Admin panel to say example.local/blog/%postname%

it shows full post name in the address bar, when I click any post, but it doesn't show any content.

here's the nginx conf file..

upstream example.local {
    server 127.0.0.1:8000 fail_timeout=30;
    keepalive 16;
}
map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}
server {
    listen 80;
    listen [::]:80;
    listen 443;
    ssl on;
    ssl_certificate /home/ssls.com/ssl-bundle-and-crt.crt;
    ssl_certificate_key /root/project1.key;
    server_name *.example.local example.local;  
    client_max_body_size 10M;

    gzip on;
    gzip_disable "msie6";

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/javascript text/xml application/xml+rss;


    location ^~ /blog {
        #autoindex on;
        index index.php index.html index.htm index.nginx-debian.html;
            alias /var/www/html/wordpress;
        try_files $uri $uri/ /blog/index.php?$args;
            location ~ \.php$ {
                include fastcgi_params;
                        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
            }
    }

    location / {
        proxy_pass http://example.local;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    proxy_read_timeout 300;
    }
    location ~ ^/static/(.*)$ {
        root /;
        try_files /root/project/project/staticfiles/$1 =404;
        expires 7d;
        add_header Pragma public;
        add_header Cache-Control "public";
    }
location /media {
    autoindex on;
    alias /root/project/project/media; 
}
    if ($scheme != "https") {
        return 301 https://$server_name$request_uri;
    }
}

As you can see, URL redirect rule is set properly under /blog location. but when I click the post, it only shows blog menu bar and nothing under, I mean no post-content

down below is .htaccess file

# BEGIN WordPress                                                                                                                                                 %
<IfModule mod_rewrite.c>                                                                                                                                          %
RewriteEngine On                                                                                                                                                  %
RewriteBase /                                                                                                                                                     %
RewriteRule ^index\.php$ - [L]                                                                                                                                    %
RewriteCond %{REQUEST_FILENAME} !-f                                                                                                                               %
RewriteCond %{REQUEST_FILENAME} !-d                                                                                                                               %
RewriteRule . /index.php [L]                                                                                                                                      %

I tried to disable .htaccess too, but still same

  • Do you have WP_DEBUG set to true, and do you see anything in your server error_log? It sounds like the page is broken but failing without showing errors. – Alexander Holsgrove Oct 22 '19 at 9:51
  • no error log is clean, I see your point, so how to troubleshoot it? page is showing content with default plain permalink settings.. – user177175 Oct 22 '19 at 9:59
  • You can take a look at the Rewrite Rules Inspector plugin to see what is being requested - it's a bit old but still useful. Put the URL in that you are having problems with and maybe share a screenshot of the rewrite rules from that plugin. You can then compare those against the default permalink structure using the plugin. – Alexander Holsgrove Oct 22 '19 at 10:27
  • @Alexander I've tried that plugin but still no luck – user177175 Oct 22 '19 at 10:58
  • Can you share the URL and screenshot please, otherwise I'm just guessing. – Alexander Holsgrove Oct 22 '19 at 22:28

Your Answer

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

Browse other questions tagged or ask your own question.