我正在尝试将example.com
多站点 WordPress 安装移至其单独的 WordPress 安装文件夹。我已经设置了一个单独的数据库,并wp-config.php
为新的 WordPress 安装创建了一个新文件,其中包含启动新安装所需的信息。问题是,当我将 Nginx 配置文件中的参数root
从旧的多站点安装文件夹切换到新的文件夹时,Nginx 仍会加载旧网站。
/etc/nginx/sites-available/example.com.conf
server {
listen 80;
listen [::]:80;
server_name example.com;
root /var/www/wordpress_exanoke/; # <-- this was changed to point to
# the new single site installation
# the old multisite installation
# folder is /var/www/wordpress
if ($scheme = "http") {
rewrite ^ https://$server_name$request_uri? permanent;
}
location / {
try_files $uri @index_php;
}
location @index_php {
proxy_pass http://127.0.0.1:8090;
proxy_set_header Host $host;
}
location /wp-admin {
index index.php;
}
location ~* .php$ {
try_files $uri =404;
proxy_pass http://127.0.0.1:8091;
proxy_set_header Host $host;
}
listen 443 ssl; # managed by Certbot
listen [::]:443 ssl; #ipv6only=on; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/chained.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/domain.key; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
ssl_client_certificate /etc/nginx/certs/cloudflare.crt;
ssl_verify_client on;
}
答案1
事实证明,您正在使用 NGINX Unit 来提供 PHP 代码。在这种情况下,您还需要更改提供给 unit 的配置文件中的文档根目录,然后重新提交 API 调用以重新加载新配置。
答案2
您重启了nginx
服务器吗?
nginx
需要重新启动才能加载新配置。
使用命令sudo nginx -t
测试您的配置是否正确。
并sudo systemctl restart nginx
重新启动。