Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
555 views
in Technique[技术] by (71.8m points)

vue.js - config nginx to serve vuejs app on subdomain

I want to run vuejs app on sub.domain.com, and I simply configure nginx like bellow:

server {
   listen 80;
   listen 443;
   ssl on;
   ssl_certificate /etc/nginx/ssl/xxx.pem;
   ssl_certificate_key /etc/nginx/ssl/xxx.key;

   server_name sub.domain.com;
   charset utf-8;
   root    /var/www/xxx/dist;
   index   index.html index.htm;

   location / {
      root /var/www/xxx/dist;
      try_files $uri /index.html;
   }
   error_log  /var/log/nginx/xxx-error.log;
   access_log /var/log/nginx/xxx-access.log;
}

but when I apply this configuration, the vuejs app loads on main domain (domain.com) and breaks the website. I can not understand what is wrong here! and also when I remove the lines related to ssl, all is good and it works as I expect on http


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...