Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have installed an ssl certificate on my server, and read a whole lot and did all the different suggested things, but I cannot seem to get the $_SERVER['HTTPS'] variable to show up. Someone please help. Here's my config:

Server: Linode Ubuntu 8.02LTS nginx - latest created a 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;

The verification from digicert comes back accurate, but I get a message saying that some info may not be secure - I understand this is the case because of the various links to non-secure pages on the site. The phpinfo shows up green https;

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.

share|improve this question

1 Answer 1

I didn't understand the last part of your question, you need what to show as in the $_SERVER array?

Anyway, SSL starts before any host exchange takes place so you can only have one HTTPS por IP address. Your config right now makes all requests to be handled by the default server.

Take a look at this quick guide and it will solve most of your doubts about SSL and Nginx.

share|improve this answer
    
Hi coredump, sorry I missed that part. I need the $_SERVER['https'] to be on in the $_SERVER array. I'm not sure what you mean "SSL starts before any host exchange takes place so you can only have one HTTPS por IP address. Your config right now makes all requests to be handled by the default server." How do I change that? Sorry never did this before –  MrMaksimize Feb 22 '11 at 20:30
    
Did you read the guide? –  coredump Feb 22 '11 at 21:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.