0
我是NGINX configs的新手,所以請耐心等待。下面是我的配置,其對整個網站正常工作:Nginx的WordPress配置,在主題目錄中的PHP文件不傳遞給FastCGI
server {
listen ...;
server_name funkyoslo.no;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location/{
root /usr/share/nginx/funkyoslo.webbr.org/html;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/funkyoslo.webbr.org/html/;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/funkyoslo.webbr.org/html/$fastcgi_script_name;
include fastcgi_params;
}
}
不過,我試圖加載文件/wp-content/themes/funkyoslo/load-songs.php和它給了我一個500內部服務器錯誤。我檢查了錯誤日誌,顯然該文件根本不傳遞給FastCGI。
我嘗試添加以下塊無濟於事:
location ~ .*/wp-content/themes/funkyoslo/.*\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/funkyoslo.webbr.org/html/wp-content/themes/funkyoslo/$fastcgi_script_name;
include fastcgi_params;
}
任何幫助,不勝感激!
這使我以下錯誤: [EMERG] 8088#0:* 1:在上游「http://127.0.0.1:$ [錯誤] 8109#0無效的主機重寫或內部重定向循環wh $ –
添加:'fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;'似乎有助於根目錄,但/wp-content/themes/funkyoslo/load-songs.php仍然存在問題 –
Nevermind,它現在可以工作了!顯然,我的PHP文件(由於我的電腦和VPS上的php.ini不同)在PHP-FPM錯誤日誌中顯示錯誤,我無法發現它,因爲AJAX負載是得到安寧給我一個500內部服務器錯誤。 我不認爲我的初始配置有什麼問題,儘管您現在已經爲我提供了一個更好的設置,謝謝! :) –