我是node.js
和digital ocean
的新手。我在node.js中创建了一个项目并将其托管在数字海洋服务器上。虽然它在http服务器中正常工作,但在将其更改为https服务器后出现问题。
索引页面加载正常(https://ap.locals
),但登录页面(https://ao.locals/login
)出现404错误。
https服务器是使用ngnix
创建的。问题是什么?
答案 0 :(得分:0)
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl on;
ssl_certificate /etc/letsencrypt/live/ap.locals/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ap.locals/privkey.pem;
access_log /var/log/nginx/ap.locals.access.log;
error_log /var/log/nginx/ap.locals.error.log;
server_name _;
root /var/www/html;
index index.html;
gzip on;
gzip_proxied any;
gzip_types text/css text/javascript text/xml text/plain application/javascript application/x-javascript application/json;
location /.well-known/ {
try_files $uri $uri/ =404;
}
location / {
include /etc/nginx/proxy_params;
proxy_pass http://localhost:8080;
proxy_read_timeout 90s;
proxy_redirect http://localhost:8080 https://ap.locals;
}
}