我已经在服务器上安装了 SSL 证书,阅读了大量资料并按照各种建议做了,但似乎无法显示 $_SERVER['HTTPS'] 变量。请有人帮忙。这是我的配置:
服务器:Linode Ubuntu 8.02LTS nginx-最新创建了一个vhost:
server {
listen 443;
server_name www.buzzonstage.com;
rewrite ^/(.*) https://buzzonstage.com/$1 permanent;
}
server {
listen 443;
server_name buzzonstage.com;
ssl on;
ssl_certificate /usr/local/nginx/conf/buzzonstage.com.pem;
ssl_certificate_key /usr/local/nginx/conf/buzzonstage.com.key;
access_log /home/maksimize/public_html/buzzonstage.com/log/access.log;
error_log /home/maksimize/public_html/buzzonstage.com/log/error.log;
location / {
root /home/maksimize/public_html/buzzonstage.com/public/;
index index.php index.html;
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/maksimize/public_html/buzzonstage.com/public/$fastcgi_script_name;
fastcgi_param HTTPS on;
}
}
server {
listen 80;
server_name www.buzzonstage.com;
rewrite ^/(.*) http://buzzonstage.com/$1 permanent;
}
server {
listen 80;
server_name buzzonstage.com;
access_log /home/maksimize/public_html/buzzonstage.com/log/access.log;
error_log /home/maksimize/public_html/buzzonstage.com/log/error.log;
location / {
root /home/maksimize/public_html/buzzonstage.com/public/;
index index.php index.html;
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /home/maksimize/public_html/buzzonstage.com/public/$fastcgi_script_name;
digicert 的验证结果准确,但我收到一条消息,说某些信息可能不安全 - 我知道这是因为网站上有各种指向不安全页面的链接。phpinfo 显示绿色 https;
但是为了使某个 drupal 模块(securepages)正常工作,我需要能够在 $_SERVER 数组中显示该变量。
答案1
我不明白你的问题的最后一部分,你需要在数组中显示什么$_SERVER
?
无论如何,SSL 在任何主机交换发生之前启动,因此您只能有一个 HTTPS por IP 地址。您的配置现在使所有请求都由默认服务器处理。
看看这个快速指南它将解决您对 SSL 和 Nginx 的大部分疑问。