search

Home  >  Q&A  >  body text

vue.js - nginx cannot open web page after setting https

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梦2721 days ago1415

reply all(2)I'll reply

  • 欧阳克

    欧阳克2017-06-21 10:13:45

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

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-06-21 10:13:45

    Check if the server443port is open

    reply
    0
  • Cancelreply