• [Nginx]status:203 Failed to start The NGINX HTTP and reverse proxy server


    怎么感觉Linux的nGinx比Win的事一个一个一个的多啊(半恼)

    运行systemctl status nginx时提示:

    ① Process: 123456 ExecStartPre=/usr/local/nginx/sbin/nginx -t (code=exited, status=203/EXEC)

    这是【nginx.service】里配置绝对路径不匹配的问题:

    cp /usr/lib/systemd/system/nginx.service /usr/lib/systemd/system/nginx.service.bak
    
    vim /usr/lib/systemd/system/nginx.service

    源文件显示可能是

    [Unit]
    
    Description=The NGINX HTTP and reverse proxy server
    
    After=syslog.target network.target remote-fs.target nss-lookup.target
    
    [Service]
    
    Type=forking
    
    PIDFile=/usr/local/nginx/logs/nginx.pid
    
    ExecStartPre=/usr/local/nginx/sbin/nginx -t
    
    ExecStart=/usr/local/nginx/sbin/nginx
    
    ExecReload=/usr/local/nginx/sbin/nginx -s reload
    
    ExecStop=/bin/kill -s QUIT $MAINPID
    
    ExecStartPost=/bin/sleep 0.1
    
    PrivateTmp=true
    
    [Install]
    
    WantedBy=multi-user.target

    更改为nginx的正确路径即可,比如我的是/usr/local/nginx/nginx-1.22.0/,则:

    ② Process: 123456 ExecStart=/usr/local/nginx/nginx-1.22.0/sbin/nginx (code=exited, status=1/FAILURE)

    nginx.conf 文件配置问题,在nginx文件里运行

    ./nginx -c /usr/local/nginx/nginx-1.22.0/conf/nginx.conf

    然后根据报错位置修改即可

    ③ Process: nginx[123456]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

    端口被进程占用,kill掉即可

    先检测是什么进程占用该端口

    lsof -i :80

     然后根据【PID】执行kill命令即可,比如上图的kill是

    kill 159911

    再次运行systemctl start nginx&&systemctl status nginx看看状态提示即可

  • 相关阅读:
    java正则表达式学习
    使用TypeScript,AngularJs和Web API构建基本的CRUD Web 应用
    漫话CLR ---- 常量与字段
    漫话CLR ---- 属性
    漫话CLR ---- 定制Attribute
    分享一个线程安全的加载窗体
    漫话CLR ---- 类型基础
    漫话CLR ---- 委托
    js 数组遍历for..in弊端
    使用call来实现继承
  • 原文地址:https://www.cnblogs.com/cela/p/manual_nginx.html
Copyright © 2020-2023  润新知