Heim  >  Fragen und Antworten  >  Hauptteil

vue.js – Nginx kann die Webseite nach dem Festlegen von https nicht öffnen

Nachdem Nginx konfiguriert wurde, kann über http darauf zugegriffen werden, aber nicht über https. Alle in Alibaba Cloud erstellten Zertifikate haben die Prüfung bestanden, die Zertifikatsdateien wurden hinzugefügt und beim Neustart von Nginx wird kein Fehler gemeldet.

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

Das Folgende ist die aktuelle Nginx-Konfiguration,

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梦2676 Tage vor1379

Antworte allen(2)Ich werde antworten

  • 欧阳克

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

    Nginx对Https支持不好,要用Http跳Https

    Antwort
    0
  • 给我你的怀抱

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

    看下服务器443端口是否已经开放

    Antwort
    0
  • StornierenAntwort