关于反向代理
安装
直接apt安装
sudo apt-get install nginx
配置文件路径
/etc/nginx/nginx.config
开启防火墙
sudo ufw allow 'nginx http'
先设置hosts
sudo vim /ect/hosts
设置你自己的ip对应的映射
如
127.0.0.1 miracle.ling.com
就是把本地localhost映射到miracle.ling.com
基本配置
server {
#端口号
listen 80;
#映射名称
server_name miracle.ling.com;
#代理路径 / 表示后面的路径,也可以设置 (~ /a)就是访问 miracle.ling.com/a才会跳转
location / {
proxy_pass http://127.0.0.1:9001;
}
}
重启nginx
sudo nginx -s reload