老师您好 能帮我看下配置吗
来源:3-10 搭建静态资源服务器
慕用1916611
2020-07-24
#user XJunYing owner;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 9000;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
server {
listen 8081;
server_name resouce;
root H:\resouces;
autoindex on;
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
除了一直返回500提示之外
只要我把user的注释“#”删除掉
就会提示 nginx: [warn] “user” is not supported, ignored in H:\nginx/conf/nginx.conf:1
写回答
2回答
-
江户川武力
2020-08-15
同学,我之前跟你出现一样的问题,浏览器报500错误,然后我修改了一些配置以后换成了404错误,但是我的404不是权限问题,是路径问题,也就是自己搭的service中的root写的有误,哪个路径在windows上面写成相对路径,是相对于你的nginx.exe的路径,也就是你的nginx服务器安装的路径。我改掉以后错误就没有了。另外经过实测文件夹名称为resource也是没有问题的。所以我的配置是:root ./resource。不过如果真怕出现问题建议改成source会好记一点。我的路径的./指的是当前目录,也就是我把resource手动添加到nginx同文件夹下了这样能省好多处理环节。你重新配置一下看看是否管用。
032022-01-14 -
扬_灵
2020-07-24
同学你好,"user" is not supported,这个应该只是warning,不会影响你实际运行。
012020-08-15
相似问题