我一直在尝试为我的Nginx服务器设置SSL几个小时,但它一直在说"无法访问此网站。连接被拒绝"当我访问我的页面时。没有SSL,一切正常。
我的nginx.conf看起来像这样:
# HTTP SERVER
server {
server_name example.com;
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
# WE USE JUST HTTPS
location / {
rewrite ^ https://$http_host$request_uri? permanent;
}
}
# HTTPS Server
server {
listen 443;
server_name example.com;
ssl on;
ssl_certificate /etc/nginx/ssl/example.com.crt; # path to your cacert.pem
ssl_certificate_key /etc/nginx/ssl/example.com.key; # path to your privkey.pem
access_log /var/log/nginx/client-access.log;
error_log /var/log/nginx/client-error.log;
root /usr/share/nginx/html;
index index.html index.htm;
location / {
try_files $uri $uri/ index.html /index.html;
}
}
显然我的server_name在我的文件中插入了正确的服务器名称。如果有人可以帮助我,那真是太棒了。
Nginx服务器设置为ReactJS应用程序服务。