nginx无法启动,报错各位大神看一下 10C

nginx改了配置文件后启动不起来了
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      443 ssl ;
    server_name  www.1haoshopping.cn;
    ssl_certificate  /home/Nginx/1_www.1haoshopping.cn_bundle.crt;
    ssl_certificate_key  /home/Nginx/2_www.1haoshopping.cn.key;
    ssl_session_timeout 5000m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
    ssl_prefer_server_ciphers on;
    add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
    add_header Content-Security-Policy upgrade-insecure-requests;
    if ( $scheme = http ) {
         rewrite ^/(.*) https://$server_name/ permanent;
       }

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
      proxy_pass http://120.77.232.4:8099/;
      proxy_set_header HOST $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    }

    #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;
    #}
}


# 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;
#    }
#}

}

6个回答

你nginx -tnginx -t 指定配置文件 ,查看配置那里错了

tanzhengkang
tanzhengkang 回复p734589527: 路径错了,你用绝对路径试试 nginx -t -c D:/nginx/conf/nginx.conf
一年多之前 回复
weixin_42246978
weixin_42246978 因该是路径的问题
2 年多之前 回复
qq_42636705
茶凉酒寒! 文件配置错了
2 年多之前 回复
weixin_42633305
朱英龙 配置出错了
2 年多之前 回复
p734589527
p734589527 可是里面没有n呀
2 年多之前 回复
p734589527
p734589527 nginx: invalid option: "n"
2 年多之前 回复

先把注解全部去掉,这样看的清晰,报错说的是n,看看是不是证书的路径不正确,Nginx目录的N你可能自己写的是小写n

没有报错吗,一般都会有报错信息,哪一行出错都有的

nginx -t 查看错误信息

p734589527
p734589527 nginx: invalid option: "n",可是里面没有n呀
2 年多之前 回复

nginx -t 查看错误 然后 nginx -s reload 重启

启动后看看日志信息,是否报错。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐