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
相关推荐
tritone21 小时前
我在阿贝云免费服务器上搭建RustDesk自建服务器(Self-Hosting)的真实体验【推荐】
运维·服务器
2301_8000509921 小时前
DNS 服务器
linux·运维·笔记
慌糖21 小时前
自动化接口框架搭建分享-pytest第二部分
运维·自动化·pytest
Lin_Aries_042121 小时前
容器化简单的 Java 应用程序
java·linux·运维·开发语言·docker·容器·rpc
岁岁种桃花儿1 天前
详解 Kubernetes 命令:kubectl exec -it nginx -- bash 及实战场景
运维·nginx·kubernetes
小牛马爱写博客1 天前
DNS 服务器与 DHCP 服务器详解及配置指南
linux·运维·服务器·dns·dhcp
维尔切1 天前
HAProxy 负载均衡器
linux·运维·数据库·负载均衡
VueVirtuoso1 天前
前后端部署 + Nginx 配置 + Cloudflare 全攻略(通俗易懂版)
运维·nginx
QQ12958455041 天前
服务器跨域问题CORS的解决
运维·服务器
小白银子1 天前
零基础从头教学Linux(Day 42)
linux·运维·服务器·网络·nginx