我使用Nginx将wordpress多站点迁移到VPS,并在每个子目录mysite.com/subdir上排除404 nginx错误,不包括/ wp-admin。 这是我的Nginx虚拟主机配置:
server {
listen 80;
listen [::]:80;
root /var/www/mysite.com/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name mysite.com www.mysite.com mysite.com/subsite;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
谢谢您的帮助!