WordPress从Apache

时间:2018-02-08 05:30:58

标签: php wordpress apache nginx permalinks

背景:

我的 Nginx服务器阻止目前如下:

upstream php {
    server unix:/run/php-fpm/php-fpm.sock;
}

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

    root /var/www/docosacramento.com/public_html;
    index index.php index.html index.htm;

    server_name docosacramento.com www.docosacramento.com;

    if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php?q=$1 last;
    }

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

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

    error_page 404 /404.html;

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
            root /usr/share/nginx/html;
    }

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
            include fastcgi_params;
            fastcgi_cache_key $host$request_method$request_uri;
    }
}

我猜这个网站有4个帖子类别(新闻,博客,图库和新闻发布)都需要位置块,所以我创建了一个location /news {...块测试但在访问以/news/开头的帖子时似乎没有做任何更改。此外,每次我编辑Nginx服务器块时,我都确定会运行以下命令:

  • sudo nginx -t
  • sudo service nginx restart
  • sudo service php5-fpm restart

还有什么我可以尝试或测试的吗?我可以提供任何日志或其他信息吗?请告诉我!

更新 - 开启Wordpress调试的错误消息,在调试了一些简单的调试后进行了修改:

  

严格标准:sidebar_walker :: start_el()的声明应该是   兼容Walker_Page :: start_el(& $ output,$ page,$ depth = 0,   $ args = Array,$ current_page = 0)in   /var/www/docosacramento.com/public_html/wp-content/themes/downtown-commons/functions.php   在第0行

     

严格标准:宣言   themeslug_walker_nav_menu :: start_lvl()应与之兼容   Walker_Nav_Menu :: start_lvl(& $ output,$ depth = 0,$ args = Array)in   /var/www/docosacramento.com/public_html/wp-content/themes/downtown-commons/functions.php   在第0行

     

解析错误:语法错误,文件意外结束   /var/www/docosacramento.com/public_html/wp-content/themes/downtown-commons/single-post.php   在第52行

解决问题后的最终更新 single-post.php中的第34行已更新为:

<?php } ?>,之前是<? }?>

0 个答案:

没有答案