我試過了所有的東西,但我仍然無法在瀏覽器上顯示錯誤,我使用nginx,php-fpm和centOS 6.4獲取錯誤502而不是在nginx + php-fpm上顯示錯誤
nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
這裏面conf.d
server {
listen 80;
server_name localhost;
root /server/public;
index run.php;
location/{
try_files $uri $uri/ /run.php;
}
location ~ \.php$ {
fastcgi_index run.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
PHP-FPM配置
catch_workers_output = yes
php_flag[display_errors] = on
php_admin_flag[log_errors] = on
我nginx的配置
的php.ini
display_errors = on
log_errors = on
我VirtualBox上運行的CentOS 6.4啓用NAT,如果我從服務器內部的本地主機捲曲我得到正確的錯誤,但如果我從瀏覽器訪問該網站的外服務器我得到一個502錯誤的網關錯誤,如果我正在加載的頁面沒有錯誤一切工作正常,我錯過了什麼?
'cat'你的''/ var/log/nginx/error.log'文件並找出當你訪問系統時web服務器看到的確切錯誤,因爲502通常意味着網關沒有正確配置, 'php5-fpm'通常意味着你不是'fastcgi_pass'-正確的路徑 –