【发布时间】:2020-12-14 07:35:27
【问题描述】:
我正在尝试将我的 react 应用程序部署到 nginx 服务器。 Http 配置工作正常,但 https 不工作。这是我的配置文件。
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name example.com;
root D:\\path-to-build\\build;
index index.html;
location / {
try_files $uri /index.html =404;
}
}
server {
listen 443 ssl;
server_name example.com;
keepalive_timeout 70;
ssl_certificate C:\\Certbot\\live\\domain\\fullchain.pem;
ssl_certificate_key C:\\Certbot\\live\\domain\\privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
#...
access_log D:\\path-to-log\\access.log;
error_log D:\\path-to-log\\error.log;
root D:\\path-to-build\\build;
index index.html;
location / {
try_files $uri /index.html =404;
}
}
}
【问题讨论】:
-
“但是https不起作用”是什么意思,有错误?无法连接?
-
当我尝试使用 https.example.com URL 进行访问时,出现错误“连接已超时”。我的服务器配置是否有效?
标签: reactjs nginx https configuration