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;
}
}
Nginx does not support HTTPS well, you need to use Http to jump to HTTPS
Check if the server
443
port is open