Nginx
為什麼 Nginx PHP Unit 忽略了這個配置文件中的 root 參數?
我正在嘗試
example.com
從多站點 WordPress 安裝移動到其單獨的 WordPress 安裝文件夾。我已經設置了一個單獨的數據庫,並wp-config.php
為新的 WordPress 安裝創建了一個新文件,其中包含啟動新安裝所需的資訊。問題是當我root
將Nginx配置文件中的參數從舊的多站點安裝文件夾切換到新的時,舊網站仍然被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; }
事實證明,您正在使用 NGINX 單元來提供您的 PHP 程式碼。在這種情況下,您還需要更改您提供給單元的配置文件中的文件根目錄,並重新送出 API 呼叫以重新載入新配置。
你重啟
nginx
伺服器了嗎?
nginx
需要重新啟動才能載入新配置。使用命令
sudo nginx -t
測試您的配置是否正確。並
sudo systemctl restart nginx
重新啟動。