我正在将一些网站从 Apache 迁移到 Nginx,并尝试配置一个网站来响应 SSL 请求。目前我得到了服务器没有响应错误。如果我切换到端口 80,我会收到一个 nginx 错误(不必担心错误本身,因为 nginx 至少正在提供服务)。
对于这个网站,我希望它仅有的回答 SSL 请求。服务器块如下所示:
server {
listen 443;
server_name dev.project.mydomain.net;
root /opt/dev/project-root;
index index.php;
ssl on;
ssl_certificate /etc/ssl/certs/mycert.crt;
ssl_certificate_key /etc/ssl/certs/mycert.pem;
access_log /var/log/nginx/vh.dev-project.access.log;
error_log /var/log/nginx/vh.dev-project.error.log;
location /aliasing/ {
alias /opt/dev/project-root/aliased;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
任何见解都将不胜感激。
更新
我的 http 块:
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
答案1
如果您启用了防火墙,我希望您已经打开了 TCP443 端口?(这很明显,但我以前自己也忽略了这一点。)