Drupal,nginx,ssl和php - 一场噩梦

时间:2011-02-22 01:26:27

标签: php drupal ssl nginx

我想我也会过帖到stackoverflow;这是我的问题:
我在我的服务器上安装了一个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数组中显示该变量。有人可以帮忙吗?

谢谢!

2 个答案:

答案 0 :(得分:0)

The phpinfo shows up green https;

这很好。因为phpinfo适用于$ _SERVER ['HTTPS']变量。而且它肯定是定义的。

but I get a message saying that some info may not be secure
But in order for a certain drupal module to work - securepages
I need to be able to show a that variable in the $_SERVER array.
嗯,可能是这些模块试图在没有https的情况下工作?例如通过AJAX? 在他们得到答案的地方,HTTPS没有定义。 尝试通过将fastcgi_param HTTPS on;添加到配置的NON https部分来检查此问题。我想所有人都会开始工作。但很明显,这是一个骗子......

答案 1 :(得分:0)

Twitter模块正在打破SSL。修改它以便它只通过SSL传递(需要重写小部件,以便它在本地加载,是的,这是可能的),一切都应该工作。