启用WordPress永久链接时出现404错误,运行Nginx

时间:2015-03-23 14:58:16

标签: wordpress nginx

我有一些问题让我的WordPress博客与Nginx合作,任何建议都会很棒,我在任何地方都会收到404错误,除了主页加载好,有什么建议吗?

我在这里收录了我的conf文件......

server {
    server_name mydomain.com www.mydomain.com;
    listen 11.11.11.11;
    root /home/mydomain/public_html;
    index index.html index.htm index.php;
    access_log /var/log/virtualmin/mydomain.com_access_log;
    error_log /var/log/virtualmin/mydomain.com_error_log;
    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    fastcgi_param SCRIPT_FILENAME /home/mydomain/public_html$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT /home/mydomain/public_html;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/php-nginx/142618852813437.sock/socket;
    }
    listen 11.11.11.11:443 default ssl;
        }

1 个答案:

答案 0 :(得分:0)

您在那里错过了一条重要指令:

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

顺便说一句,ssl在这个配置中不起作用,你需要更多指令there