Wordpress 关于在nginx conf中使用try_文件替换重写的问题
我的wordpress站点有一个nginx配置。重写太多了。 我想替换重写以尝试_文件并减少conf文件 这是我的nginx配置:Wordpress 关于在nginx conf中使用try_文件替换重写的问题,wordpress,file,nginx,rewrite,reduce,Wordpress,File,Nginx,Rewrite,Reduce,我的wordpress站点有一个nginx配置。重写太多了。 我想替换重写以尝试_文件并减少conf文件 这是我的nginx配置: server { listen 80; server_name domain.com www.domain.com; index index.php; root /home/domain.com; location / { try_files $uri $uri/ /index.php?$arg
server
{
listen 80;
server_name domain.com www.domain.com;
index index.php;
root /home/domain.com;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ^~ /topics/ {
try_files $uri $uri/ /index.php;
rewrite ^/topics/(.*).html$ $scheme://$host/topics/$1/ permanent;
rewrite ^/topics/(.*).html/(.*)$ $scheme://$host/topics/$1/$2 permanent;
rewrite ^/topics/([0-9]+)/([0-9]+)/([0-9]+)/(.*)/$ $scheme://$host/topics/$4/ permanent;
rewrite ^/topics/([0-9]+)/([0-9]+)/([0-9]+)/(.*)/(.*)$ $scheme://$host/topics/$4/$5 permanent;
rewrite ^/topics/tag/(.*)$ $scheme://$host/tag/$1 permanent;
rewrite ^/topics/category/(.*)$ $scheme://$host/category/$1 permanent;
}
location ~ ^/topics/.+\.php$ {
set_real_ip_from 127.0.0.1;
real_ip_header X-Real-IP;
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
rewrite ^/([0-9]+)/([0-9]+)/([0-9]+)/(.*)/$ $scheme://$host/topics/$4/ permanent;
location ~ .*\.php(\/.*)*$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
set_real_ip_from 127.0.0.1;
real_ip_header X-Real-IP;
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
access_log off;
}
我如何减少和替换它?多谢各位