以下内容不具有共用性。
第一步:修改host文件sudo vim /etc/hosts第二步:下载nginx 第三步:修改nginx的配置文件
1、修改nginx.conf文件
路径: /opt/homebrew/etc/nginx/nginx.conf
具体配置:
worker_processes 1;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
# 域名
server_name xxx.com;
root html;
location / {
# 设置代理服务器的地址
# ping ip
# telnet ip 端口
proxy_pass http://ip:端口;
}
location ~ .*.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|woff|ttf|json|svg|oga|mp3|map)$ {
# 静态文件目录
root /opt/homebrew/Cellar/nginx/1.21.6_1/html/sp-web-sgp/static;
}
}
include servers/*;
}
2、修改nginx的静态文件
启动nginx即可
启动服务:sudo nginx 停止服务:sudo nginx -s stop
关于nginx中的proxy_pass详解:https://blog.csdn.net/yujia_666/article/details/111595082
安装nginx参考: https://blog.csdn.net/weixin_45406712/article/details/122338225



