子目录nginx 404中的Wordpress永久链接

时间:2017-02-10 10:06:07

标签: php wordpress reactjs nginx

我正在尝试在子目录/blog中添加wordpress,反应应用程序在root中运行。已成功安装Wordpress并使用简单的永久链接正常工作: https://foo.com/blog/?p=8 https://foo.com/blog/?page_id=8

但使用漂亮的永久链接时返回404错误: https://foo.com/blog/postname/

nginx conf:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name foo.com;

    return  301 https://$server_name$request_uri;
}

# HTTPS server

server {
    listen 443;
    server_name foo.com;

    root /data/www/foo;
    index index.html index.htm;

    ssl on;
    ssl_certificate /etc/nginx/nginx.crt;
    ssl_certificate_key /etc/nginx/nginx.key;

    ssl_session_timeout 5m;

    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
    ssl_prefer_server_ciphers on;

    location / {
            proxy_pass https://127.0.0.1:8443;
    }


    location /learn {
            root /data/www/foo;
            index index.php index.html index.htm
            try_files $uri $uri/ /learn/index.php?$args;
    }


    location ~ /blog/.+\.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        root /data/www/foo;
    }


    location ~ /blog/.+\.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;

我该如何解决这个问题? 谢谢! `

0 个答案:

没有答案
相关问题