2015-07-20 119 views
2

我一直有一些問題,我的NginX安裝。我沒有收到任何錯誤,但是,當我嘗試訪問我的本地主機地址時,出現了經典的「500 - 內部服務器錯誤」。Nginx 500(內部服務器)錯誤

這是我的配置:

user  nobody; ## Default: nobody 
worker_processes 5; ## Default: 1 
error_log logs/error.log; 
pid  logs/nginx.pid; 
worker_rlimit_nofile 8192; 

events { 
worker_connections 4096; ## Default: 1024 
} 

http { 
include mime.types; 
include fastcgi.conf; 
index index index.html index.htm index.php; 

default_type application/octet-stream; 
log_format main '$remote_addr - $remote_user [$time_local] $status ' 
'"$request" $body_bytes_sent "$http_referer" ' 
'"$http_user_agent" "$http_x_forwarded_for"'; 
access_log logs/access.log main; 
sendfile  on; 
tcp_nopush on; 
server_names_hash_bucket_size 128; # this seems to be required for some vhosts 

server { # simple reverse-proxy 
listen  80; 
access_log logs/access.log main; 

# serve static files 
location ~ ^/(images|javascript|js|css|flash|media|static)/ { 
root /Library/Testing/public_html; 
expires 30d; 
} 

# pass requests for dynamic content to rails/turbogears/zope, et al 
location/{ 
proxy_pass  http://127.0.0.1:8080; 
} 
} 

upstream big_server_com { 
server 127.0.0.3:8000 weight=5; 
server 127.0.0.3:8001 weight=5; 
server 192.168.0.1:8000; 
server 192.168.0.1:8001; 
} 

server { # simple load balancing 
listen   80; 
server_name  big.server.com; 
access_log  logs/big.server.access.log main; 

location/{ 
proxy_pass  http://big_server_com; 
} 
} 
} 

有什麼問題?我查看了其他相關的SOF問題,但沒有一個解決了我的問題。謝謝。

編輯:我的日誌現在又說:2015/07/26 13:43:40 [error] 2494#0: *1 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /index.php HTTP/1.1", upstream: "http://127.0.0.1:8080/index.php", host: "localhost"

當我嘗試加載該頁面「本地主機/ index.php文件」

+0

你確定PHP沒有拋出錯誤嗎? nginx錯誤日誌中的任何東西? – Will

+0

@Will - 如何檢查PHP錯誤日誌? nginx似乎沒有說任何有用的東西。 – ColonelHedgehog

+0

運行'php --info | grep錯誤'。尋找'error_log'和'log_errors'。確保在php.ini中啓用了「log_errors」,並在'error_log'中指定了一個日誌文件的路徑。 – Will

回答

0

我固定我的問題。事實證明,我忘了激活php-fpm:sudo php-fpm這麼做。

+0

啊,我明白了。所以你的後端倒閉了。 – Will