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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM