nginx下vhost配置
配置文件所在目录: /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
posted on 2017-05-15 13:07 sunshine_zhf 阅读(2945) 评论(0) 编辑 收藏 举报