mac 安装 nginx

安装 nginx :

复制代码
brew install nginx

检查 nginx 安装是否成功:

复制代码
nginx -v

nginx version: nginx/1.29.1

查看 nginx 启动状态:

复制代码
sudo brew services info nginx

可以看到服务还未启动

nginx (homebrew.mxcl.nginx)

Running:

Loaded:

Schedulable:

nginx 配置文件位置:

复制代码
# nginx 主配置文件位于
/opt/homebrew/etc/nginx/nginx.conf

启动 nginx 服务:

复制代码
brew services start nginx
# nginx 开机自启
brew services stop nginx

nginx 常用命令

防火墙开放 nginx 端口:

如果是阿里云ECS要配置网络与安全组

开放80端口

复制代码
firewall-cmd --add-port=80/tcp --permanent

重启防火墙

复制代码
firewall-cmd --reload
相关推荐
魔道不误砍柴功3 小时前
Mac 能够连Wife,但是不能上网问题解决
网络·macos·php
Whitess0073 小时前
Websocket链接如何配置nginx转发规则?
websocket·网络协议·nginx
daizhe3 小时前
Mac M4环境下基于VMware Fusion虚拟机安装Ubuntu24.04 LTS ARM版
ubuntu·macos
小白考证进阶中8 小时前
终于赶在考试券过期前把Oracle OCP证书考下来了!
运维·数据库·oracle·dba·开闭原则·数据库管理员
keep__go9 小时前
postgresql9.2.4 跨版本升级14.6
linux·运维·数据库·postgresql
Doris_LMS9 小时前
Git的强软硬回退(三)
运维·服务器·数据库·git·idea
(Charon)9 小时前
基于 epoll 的高并发服务器原理与实现(对比 select 和 poll)
运维·服务器
Jtti10 小时前
在 Debian 系统上清理缓存的方式和具体操作方法
运维·缓存·debian
伐尘10 小时前
【mac】如何在 macOS 终端中高效查找文件:五种实用方法
运维·macos