我在centos上安装了nginx。当我尝试打开一个网站时,我收到此错误:
500 Internal Server Error
错误日志:
2012/11/01 14:10:38 [error] 4552#0: *32 open() "/var/www/mywebsite.com/web/error/404.html" failed (2: No such file or directory), client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
2012/11/01 14:10:38 [error] 4552#0: *32 open() "/var/www/mywebsite.com/web/error/404.html" failed (2: No such file or directory), client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
2012/11/01 14:10:38 [error] 4552#0: *32 open() "/var/www/mywebsite.com/web/error/404.html" failed (2: No such file or directory), client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
2012/11/01 14:10:38 [error] 4552#0: *32 open() "/var/www/mywebsite.com/web/error/404.html" failed (2: No such file or directory), client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
2012/11/01 14:10:38 [error] 4552#0: *32 open() "/var/www/mywebsite.com/web/error/404.html" failed (2: No such file or directory), client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
2012/11/01 14:10:38 [error] 4552#0: *32 open() "/var/www/mywebsite.com/web/error/404.html" failed (2: No such file or directory), client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
2012/11/01 14:10:38 [error] 4552#0: *32 open() "/var/www/mywebsite.com/web/error/404.html" failed (2: No such file or directory), client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
2012/11/01 14:10:38 [error] 4552#0: *32 open() "/var/www/mywebsite.com/web/error/404.html" failed (2: No such file or directory), client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
2012/11/01 14:10:38 [error] 4552#0: *32 open() "/var/www/mywebsite.com/web/error/404.html" failed (2: No such file or directory), client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
2012/11/01 14:10:38 [error] 4552#0: *32 open() "/var/www/mywebsite.com/web/error/404.html" failed (2: No such file or directory), client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
2012/11/01 14:10:38 [error] 4552#0: *32 rewrite or internal redirection cycle while internally redirecting to "/error/404.html", client: xx.xxx.xx.xxx, server: mywebsite.com, request: "GET /favicon.ico HTTP/1.1", host: "mywebsite.com"
nginx.conf (/etc/nginx/nginx.conf)
#######################################################################
#
# This is the main Nginx configuration file.
#
# More information about the configuration options is available on
# * the English wiki - http://wiki.nginx.org/Main
# * the Russian documentation - http://sysoev.ru/nginx/
#
#######################################################################
#----------------------------------------------------------------------
# Main Module - directives that cover basic functionality
#
# http://wiki.nginx.org/NginxHttpMainModule
#
#----------------------------------------------------------------------
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
#----------------------------------------------------------------------
# Events Module
#
# http://wiki.nginx.org/NginxHttpEventsModule
#
#----------------------------------------------------------------------
events {
worker_connections 1024;
}
#----------------------------------------------------------------------
# HTTP Core Module
#
# http://wiki.nginx.org/NginxHttpCoreModule
#
#----------------------------------------------------------------------
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 0;
keepalive_timeout 65;
#gzip on;
# Load config files from the /etc/nginx/conf.d directory
# The default server is in conf.d/default.conf
include /etc/nginx/conf.d/*.conf;
## Detect when HTTPS is used
map $scheme $fastcgi_https {
default off;
https on;
}
}
/etc/nginx/sites-enabled/100-mysite.vhost
server {
listen *:80;
server_name mywebsite.com www.mywebsite.com www.mywebsite2.com mywebsite2.com;
root /var/www/mywebsite.com/web;
index index.html index.htm index.php index.cgi index.pl index.xhtml;
error_page 400 /error/400.html;
error_page 401 /error/401.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 405 /error/405.html;
error_page 500 /error/500.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;
recursive_error_pages on;
location = /error/400.html {
internal;
}
location = /error/401.html {
internal;
}
location = /error/403.html {
internal;
}
location = /error/404.html {
internal;
}
location = /error/405.html {
internal;
}
location = /error/500.html {
internal;
}
location = /error/502.html {
internal;
}
location = /error/503.html {
internal;
}
error_log /var/log/ispconfig/httpd/mywebsite.com/error.log;
access_log /var/log/ispconfig/httpd/mywebsite.com/access.log combined;
## Disable .htaccess and other hidden files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location /stats {
index index.html index.php;
auth_basic "Members Only";
auth_basic_user_file /var/www/clients/client2/web3/.htpasswd_stats;
}
location ^~ /awstats-icon {
alias /usr/share/awstats/icon;
}
location ~ \.php$ {
##try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9012;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
我用替换内容测试了php,index.php
没有<?php phpinfo();
问题。
有什么建议吗?