macOS 安装 nginx

macOS 安装 nginx

brew install nginx
cp nginx.conf.default nginx.conf
cd www.conf.default www.conf


安装PHP 参考:

https://javascript.net.cn/articles/582


找到PHP的位置

/usr/local/php7

修改 ~/profile

PATH="/usr/local/php7/bin:/usr/local/php7/sbin:$PATH"


开启

php-fpm

关闭 php-fpm

sudo killall php-fpm


如果遇到上传文件权限不够

nginx open() client_body_temp failed Permission denied

修改 nginx.conf 中 user root root 不可以,需要改成 user root owner;

然后 sudo nginx 启动正常。



设置 nginx 开机启动

复制 /usr/local/Cellar/nginx/1.17.0/homebrew.mxcl.nginx.plist 到 /Library/LaunchDaemons

cp /usr/local/Cellar/nginx/1.17.0/homebrew.mxcl.nginx.plist /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
sudo chown root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist


最后 brew uninstall httpd LOL

修改时间 2022-10-12

声明:本站所有文章和图片,如无特殊说明,均为原创发布,转载请注明出处。
随机推荐
WordPress 文章页作者信息 get_the_author() 和 get_the_author_meta()
JavaScript 引用类型
HTML select 下拉列表
JavaScript Math 对象
WordPress 使用 shortcode() 增加编辑器功能
阿里云内容安全 API 签名机制
Node.js 内置模块
Node.js net 模块