zoukankan      html  css  js  c++  java
  • 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就好啦

  • 相关阅读:
    Go语言之Go语言文件处理
    Go语言之Go语言网络编程
    Go语言之Go语言并发
    Go语言之Go语言锁机制
    Go语言之Go语言 异常处理与测试
    Go语言之Go语言反射
    Go语言之Go 语言方法
    Go语言之递归函数
    js 改变文章字体大小
    .net获取当前url各种属性(文件名、参数、域名、端口等)的方法(转)
  • 原文地址:https://www.cnblogs.com/Scar007/p/12483271.html
Copyright © 2011-2022 走看看