我尝试让我的 vhost 与 Nginx 上的 SSL 证书一起工作。
当我尝试访问该网站时,出现错误 102 连接被拒绝!
server {
listen 80;
root /var/storage/linusodenring.se/www;
index index.php index.html index.htm;
server_name linusodenring.se www.linusodenring.se;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 443;
root /var/storage/linusodenring.se/www;
index index.php index.html index.htm;
server_name linusodenring.se;
ssl on;
ssl_certificate /secret/ssl_linusodenring.se/linusodenringse.crt;
ssl_certificate_key /secret/ssl_linusodenring.se/linusodenringse.key;
keepalive_timeout 50;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
我的 vhost 配置!注意它们在同一个文件中,只是 Serverfault 有问题!
答案1
我按照 Ars Technica 文章的步骤在 Nginx 中安装了 SSL,并第一次尝试成功。Web 服务,第 2 部分:使用 SSL/TLS 确保安全。