配置文件所在目录:   /usr/local/nginx/conf/vhost/XXX.conf

server {
listen 9191;
server_name localhost;  (或IP)

charset utf-8;
error_log /home/wwwlogs/cloud_dailybuild.test.frontend.error.log;
access_log /home/wwwlogs/cloud_dailybuild.test.frontend.access.log;
root "/home/production/cloud_dailybuild/cloud-frontend/dist";   #前端项目路径

gzip_static on;
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://116.62.33.242:9090;  #后端项目路径
}

location / {
try_files $uri $uri/ /index.html;
}
}

 

配置完vhost,重启nginx服务,命令:nginx -s reload

相关文章:

  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2021-05-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
相关资源
相似解决方案