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
 
 

你可能感兴趣的:(配置管理)