mac系统进行nginx代理配置
一、找到nginx配置文件
- nginx -t 可以找到nginx相关配置,进入到这个配置文件中
二、创建自己的配置文件
- 创建文件
touch app.conf
- 打开文件
code app.conf
- 复制以下配置
server {
listen 80;
server_name a.dev.com;
location / {
proxy_pass http://10.10.135.158:8090;
proxy_set_header Host $host;
}
}
三、修改hosts
- AppStore中下载IHosts
- 通过ihosts修改自己的配置 重启服务
nginx -s reload
- 这里是把a.dev.com映射到本地 127.0.0.1
四、nginx常用命令
- 开启:
nginx
- 重载:
nginx -s reload
- 关闭:
nginx -s quit