在nginx安装目录中找到conf目录在该目录下的nginx.conf配置文件中进行以下配置
upstream user.mall.starcpdk.com{
server 127.0.0.1:8080;
}
server {
listen 80;
server_name user.mall.starcpdk.com;
location / {
proxy_pass http://user.mall.starcpdk.com;
proxy_set_header X-forwarded-for $proxy_add_x_forwarded_for ;
}
}
server 127.0.0.1:8080; 配置对应的项目的访问端口
server_name的值为在上一篇文章中配置的localhost映射的域名
listen的值为80 监听80端口
location中的proxy_pass 值为访问的域名路径