胖蔡叨叨叨
你听我说

nginx配置wordpress伪静态访问

修改/etc/nginx/site-enable/default配置如下:

server {
         listen 80 default_server;
         listen [::]:80 default_server;

         server_name _;

         access_log /var/log/nginx/wordpress_access.log;
         error_log /var/log/nginx/wordpress_error.log;
         root /var/www/html;
         index index.php index.html index index.htm;
         location / {
                 try_files $uri $uri/ /index.php?args;
         }
        #add trailing slash to */wp-admin request.
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;

        location ~ \.php$ {
               include snippets/fastcgi-php.conf;
               fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
         }
 

添加:

   location / {
                 try_files $uri $uri/ /index.php?args;
         }
        #add trailing slash to */wp-admin request.
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
 

然后通过nginx 重启配置访问。

hfcai@hfcai:$sudo /etc/init.d/nginx restart

 
赞(1) 打赏
转载请附上原文出处链接:胖蔡叨叨叨 » nginx配置wordpress伪静态访问
分享到: 更多 (0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

'); })();