我的问题是我的http://kd41364.zap-hosting.com/网页在我的 Linux 上可以运行。但是,所有其他子页面都收到来自 nginx 的 404 Not Found 错误。(www.kd41364.zap-hosting.com/owncloud)我尝试了论坛上的所有方法和许多其他方法,但都没有用。
nginx.conf
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 70;
types_hash_max_size 4096;
# server_tokens off;
client_max_body_size 4000M;
# server_names_hash_bucket_size 128;
# server_name_in_redirect off;
default_type application/octet-stream;
include /etc/nginx/mime.types;
##
# Logging Settings
##
access_log /etc/nginx/logs/access.log;
error_log /etc/nginx/logs/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/html text/css
application/x-javascript text/xml
application/xml application/xml+rss
text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
#passenger_root /usr/bin/passenger_free_ruby/phusion_passenger/locations.ini;
#passenger_ruby /usr/bin/passenger_free_ruby;
##
##
# Virtual Host Configs
##
include /etc/nginx/pages/*;
include /etc/nginx/confs/*;
}
nginx 错误日志
2015/11/25 17:29:39 [emerg] 236#0: open() "/etc/nginx/logs/access.log" failed (2: No such file or directory)
2015/11/25 17:30:17 [warn] 961#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 17:30:17 [emerg] 961#0: open() "/etc/nginx/logs/access.log" failed (2: No such file or directory)
2015/11/25 17:34:09 [warn] 1560#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 17:34:09 [emerg] 1560#0: open() "/etc/nginx/logs/access.log" failed (2: No such file or directory)
2015/11/25 17:35:00 [warn] 1601#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 17:35:00 [emerg] 1601#0: open() "/etc/nginx/logs/access.log" failed (2: No such file or directory)
2015/11/25 17:36:54 [warn] 1651#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 17:36:54 [warn] 1654#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 18:08:01 [warn] 1844#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 18:08:01 [warn] 1847#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 18:26:34 [warn] 256#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 18:26:34 [warn] 278#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/26 12:23:48 [warn] 178#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/26 12:23:48 [warn] 222#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/26 12:25:42 [warn] 256#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 16:31:20 [warn] 255#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 16:31:20 [emerg] 255#0: unknown directive "passenger_root" in /etc/nginx/nginx.conf:66
2015/11/25 16:42:41 [warn] 1087#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 16:42:41 [emerg] 1087#0: unknown directive "passenger_root" in /etc/nginx/nginx.conf:66
2015/11/25 16:43:16 [warn] 1121#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 16:43:16 [emerg] 1121#0: unknown directive "passenger_root" in /etc/nginx/nginx.conf:66
2015/11/25 16:47:22 [warn] 1155#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 16:47:22 [emerg] 1155#0: open() "/etc/nginx/logs/access.log" failed (2: No such file or directory)
2015/11/25 17:09:33 [warn] 1301#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 17:09:33 [emerg] 1301#0: open() "/etc/nginx/logs/access.log" failed (2: No such file or directory)
2015/11/25 17:12:13 [warn] 1336#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 17:12:13 [emerg] 1336#0: open() "/etc/nginx/logs/access.log" failed (2: No such file or directory)
2015/11/25 17:23:28 [warn] 238#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 17:23:28 [emerg] 238#0: open() "/etc/nginx/logs/access.log" failed (2: No such file or directory)
2015/11/25 17:24:46 [warn] 962#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
2015/11/25 17:24:46 [emerg] 962#0: open() "/etc/nginx/logs/access.log" failed (2: No such file or directory)
2015/11/25 17:29:39 [warn] 236#0: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:51
虚拟主机配置:
server {
listen 80;
server_name kd41364.zap-hosting.com www.kd41364.zap-hosting.com;
root /var/www/;
index index.html index.htm index.php;
include includes/favicon.conf;
include includes/cgi.conf;
include includes/php.conf;
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
不幸的是,我不知道您需要什么帮助,所以请询问我,我会上传它。
谢谢你的帮助。
答案1
我也遇到过这个问题——text/html
总是被 HttpGzipModule 压缩,所以你不需要将它包含在 gzip_types 列表中。
如果你将 gzip 类型行更改为:
gzip_types text/plain text/css
application/x-javascript text/xml
application/xml application/xml+rss
text/javascript;
您的错误将会消失。
我还注意到您似乎不想记录 access.log - 如果是这种情况,请添加以下行:
access_log off;