• nginx经验分享


    • 如果我们在使用启动nginx时,遇到这样的提示:

    nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)

    那代表我们没有操作权限,只需要在命令前加上sudo,即可以最高权限去操作,如:

    sudo nginx
    sudo nginx -s reload | stop | reopen
    • 如果我们在启动nginx时报错,例如这样的提示:

    nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)

    那代表80端口被占用(包括nginx本身已启动占用的80端口)

    我们只需要停止占用占用80端口的服务即可,例如停止已开启的nginx

    sudo nginx -s stop
    • 如果我们在停止或者重启nginx的时候报错,例如这样的提示:

    nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)

    是因为没有找到nginx.pid这个文件,当我们停止nginx时(nginx -s stop) ,nginx 会把 /usr/local/var/run/ 路径下名为nginx.pid 的文件删掉

    我们可以直接启动nginx,重新生成nginx.pid文件即可

    nginx 或 sudo nginx
    • 若直接启动还是报错,那查看一下nginx配置文件
    nginx -t 或 sudo nginx -t

    一般是这样的提示:

    nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok

    nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

    然后我们指定下conf文件:

    nginx -c /usr/local/etc/nginx/nginx.conf
    或 sudo nginx -c /usr/local/etc/nginx/nginx.conf

    再重启nginx就好啦

  • 相关阅读:
    200. Number of Islands 200.岛屿数(可以形状一样)
    695. Max Area of Island最大岛屿面积
    springboot如何在项目启动时初始化资源
    springboot之集成Memcached
    springboot之spring-boot-admin对springboot服务进行监控
    springboot之集成FastDFS
    springboot之上传文件
    springboot之整合shiro-登录认证和权限管理
    springboot 如何测试打包部署
    springboot之Mongo
  • 原文地址:https://www.cnblogs.com/Scar007/p/12483271.html
Copyright © 2020-2023  润新知