zoukankan      html  css  js  c++  java
  • Mac使用brew安装nginx,并解决端口访问权限问题

    1、安装

    brew install nginx
    

    2、修改配置文件

    sudo vi /usr/local/etc/nginx/nginx.conf
    
    修改默认的8080端口为80
    
    修改日志文件地方
    	error_log  logs/error.log;
    
    	pid        logs/nginx.pid;
    
    	access_log  logs/access.log;
    
    按上面修改后日志文件在/usr/local/opt/nginx/logs
    

    3、修改管理员权限

    sudo chown root:wheel/usr/local/opt/nginx/bin/nginx
    sudo chmod u+s/usr/local/opt/nginx/bin/nginx
    

    4、加上launchctl控制

    mkdir -p ~/Library/LaunchAgents
    
    cp /usr/local/opt/nginx/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
    
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
    

    5、启动nginx

    sudo nginx #启动
    
    sudo nginx -t #测试配置文件是否有错
    
    sudo nginx -s reload #重启nginx
    

    6、问题

    如果出现nginx: [error] invalid PID number "" in "/usr/local/var/run/nginx/nginx.pid",则需要
    	sudo nginx -c /usr/local/etc/nginx/nginx.conf
    	sudo nginx -s reload
  • 相关阅读:
    js学习之函数
    面试题
    渐进增强(progressive enhancement)、优雅降级(graceful degradation)
    倒计时
    css 平行四边形
    网址URL分解
    图片延时加载
    获取元素的宽高,左边距上边距
    电商平台放大镜效果
    js笔记
  • 原文地址:https://www.cnblogs.com/andyfengzp/p/7476209.html
Copyright © 2011-2022 走看看