![](/img/trans.png)
[英]index.php not loading from ubuntu server VM (nginx & sftp)
[英]Nginx not loading index.php
我在ubuntu pc中使用nginx和php5-fpm,我的網站沒有加載到瀏覽器中,我已經配置了所有內容,但是運行index.php時,瀏覽器控制台出現500個內部服務器錯誤。
這是我的代碼(etc / nginx / sites-available / default)
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html/Inwiter;
index index.php index.htm index.html;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php;
#try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
幾天前,當我在配置文件中添加允許accessToken時,我也遇到了此類問題(不完全是此問題),那對我來說很好。 add_header訪問控制允許來源*;
作為您提供的日志,nginx仍嘗試將fastcgi://127.0.0.1:9000
用作fastcgi_pass。
您是否在修改后重新啟動nginx或重新加載配置?
此外,請檢查/etc/php5/fpm/pool.d/
配置文件。
必須在一行中添加listen = /var/run/php5-fpm.sock
。
我建議您刪除ipv6only=on
,然后嘗試執行以下示例配置:
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_intercept_errors on;
try_files $uri =404;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.