mac 通过 nginx 使用1024以下端口
安装配置:https://blog.****.net/one_hwx/article/details/86494178
我的nginx.conf 路径
进入 /usr/local/etc/nginx/nginx.conf (可能要使用管理员权限sudo)查看配置
vi /usr/local/etc/nginx/nginx.conf.default
把本来的模版注释掉
最底下有个 include servers/* ,所以我们可以新建一个servers目录存放我们个人修改的东西
所以在nginx目录下新建servers,在servers下再建一个配置文件default.conf
修改default文件
listen就是你需要用的端口号,这里我的8082 idea 已经启动了一个项目,通过81转发到8082
server{
listen 81;
server_name localhost;
location / {
proxy_pass http://localhost:8082;
#root html;
#index index.html index.htm;
}
}
保存退出,重启nginx
sudo nginx -s reload
那么我访问81端口则可跳到8082的网站