【问题标题】:NginX 500 (Internal Server) ErrorNginX 500(内部服务器)错误
【发布时间】:2015-07-20 03:28:43
【问题描述】:

我在安装 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"

当我尝试加载页面“localhost/index.php”时

【问题讨论】:

  • 你确定 PHP 没有抛出错误吗? nginx 错误日志中的任何内容?
  • @Will - 如何检查 PHP 错误日志? nginx 似乎没有说什么有用的东西。
  • 运行 php --info | grep error 。寻找error_log 和log_errors。确保 log_errors 在 php.ini 中打开,并在 error_log 中指定日志文件的路径。
  • 我启用了 log_errors,并且对于 error_log 我设置了默认路径:“php_errors.log” php_errors.log 似乎没有生成。
  • 您需要指定错误日志的绝对路径。试试/var/log/php_errors.log。

标签: php macos nginx


【解决方案1】:

我解决了我的问题。原来我忘了激活 php-fpm:sudo php-fpm 成功了。

【讨论】:

  • 啊,我明白了。所以你的后端宕机了。
猜你喜欢
  • 2015-03-09
  • 1970-01-01
  • 2015-06-11
  • 1970-01-01
  • 2014-08-27
  • 1970-01-01
  • 2021-03-04
  • 2016-09-05
  • 1970-01-01
相关资源
最近更新 更多