vue.js - nginx cannot open web page after setting https
过去多啦不再A梦
过去多啦不再A梦 2017-06-21 10:11:45
0
2
1375

After nginx is configured, it can be accessed through http, but cannot be accessed through https. The certificates made in Alibaba Cloud have all passed the review, the certificate files have been added, and no error is reported when restarting nginx.

这个是因为vue写的单页应用路由的关系要加上。
location / {
   try_files $uri $uri/ /index.html;
}

The following is the current nginx configuration,

server {
  listen 80;
  root /www/cms/production/current/dist;
  index index.html;
  server_name cms.xmxmxm.me;
  location / {
    try_files $uri $uri/ /index.html;
  }
}

server {
  listen 443;
  server_name cms.xmxmxm.me;
  ssl on;
  root /www/cms/production/current/dist;
  index index.html index.htm;
  ssl_certificate   cert/214165781360223.pem;
  ssl_certificate_key  cert/214165781360223.key;
  ssl_session_timeout 5m;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;

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

  location /ms/ {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-Nginx-Proxy true;

    proxy_pass http://127.0.0.1:3001;
    proxy_redirect off;
  }
}
过去多啦不再A梦
过去多啦不再A梦

reply all(2)
学霸

Nginx does not support HTTPS well, you need to use Http to jump to HTTPS

给我你的怀抱

Check if the server443port is open

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!