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
 
 
展开阅读全文
©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值