有人能告诉我这个配置文件有什么问题吗?如果我在没有证书的情况下执行此操作,一切都会正常工作。但使用 SSL 加载网站需要太多时间。也许是因为我强制重定向到 https 或类似的东西。我对 nginx 不太熟悉。尝试在谷歌上搜索类似问题,但没有从任何地方找到解决方案。
server {
client_max_body_size 100M;
server_name myserver.xyz; # managed by Certbot
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate PEM_FILE_PATH; # managed by Certbot
ssl_certificate_key PEM_FILE_PATH; # managed by Certbot
include CERTBOT_CONFIG_FILE; # managed by Certbot
ssl_dhparam PEM_FILE; # managed by Certbot
root PROJECT_ROOT;
location / {
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
server {
listen 80 ;
listen [::]:80 ;
server_name myserver.xyz;
return 301 https://$host$request_uri;
}