• Nginx——报错汇总


    前言

    记录NGINX的错误

    错误

    nginx: [emerg] unknown directive "erver" in /usr/local/nginx/conf/vhost/dev.api.ecdpower.net.conf:2

    [root@ecs-75fb-0531684 vhost]# /usr/local/nginx/sbin/nginx -t 
    nginx: [emerg] unknown directive "erver" in /usr/local/nginx/conf/vhost/dev.xxx.net.conf:2
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    

    报错很明显,这个配置文件的第2行,但是坑爹的是第一行的server错了,修改下就好了

    [root@ecs-75fb-0531684 vhost]# /usr/local/nginx/sbin/nginx -t
    nginx: [warn] conflicting server name "140.xx.11" on 0.0.0.0:40001, ignored
    nginx: [warn] conflicting server name "140.xx.11" on 0.0.0.0:443, ignored
    nginx: [warn] conflicting server name "140.xx.11" on 0.0.0.0:443, ignored
    nginx: [warn] conflicting server name "140.xx.11" on 0.0.0.0:443, ignored
    nginx: [warn] conflicting server name "140.xx.11" on 0.0.0.0:443, ignored
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
    

    nginx:post请求变为get

    1. 设置了所有http请求转为https请求造成的,去除后就好了
    2. return 307 https://<需跳转地址>$request_uri;
    

    nginx: [emerg] duplicate upstream "bakend" in /usr/local/nginx/conf/./vhost/xxxxxx.conf:1

    多个配置都用了bakend这个名称造成的,将其他的修改下就阔以了
    

    open() "/var/run/nginx.pid" failed (2: No such file or directory)

    进入到/usr/local/nginx/logs/查看error.log可以看到具体的报错信息.

    根据报错找到对应的vhost,查看配置后得知,配置中的写入日志的目录没有存在,将错误的日志路径改为正确的即可,当然别忘记reload或者restart
    

    ./configure: error: the HTTP gzip module requires the zlib library.

    完整错误信息

    ./configure: error: the HTTP gzip module requires the zlib library.
    You can either disable the module by using –without-http_gzip_module
    option, or install the zlib library into the system, or build the zlib library
    statically from the source with nginx by using –with-zlib=<path> option.
    

    解决方法

    yum install -y zlib-devel
    

    The plain HTTP request was sent to HTTPS port

    完整错误信息

    The plain HTTP request was sent to HTTPS port. Sorry for the inconvenience.
    Please report this message and include the following information to us.
    Thank you very much!
    ``
    
    解决方法
    

    监听的443端口后面加上ssl并添加相应的证书
    server {
    listen 80;
    listen 443 ssl;
    }

  • 相关阅读:
    vue
    mongodb
    ejs模板引擎
    ajax
    node.js2
    node.js1
    bootstrap,ECMA
    商城
    面试:----Struts和springmvc的区别--区别上
    OpenStack
  • 原文地址:https://www.cnblogs.com/wangyang0210/p/11528826.html
Copyright © 2020-2023  润新知