I have Secure Pages 7.x-1.0-beta2 installed on two Drupal sites running on Nginx. I applied the 2 patches listed on the project page. I have also tried applying the suggestions listed in this article:

http://www.metaltoad.com/blog/running-drupal-secure-pages-behind-proxy

1. settings.php

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
  $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
  $_SERVER['HTTPS'] = 'on';
}

2. nginx vhost file:
location / {proxy_set_header X-Forwarded-Proto $scheme;}

The option remains greyed out even when I visit the link to use if the test has failed. I have Secure Pages enabled on three other Drupal sites that are running on Apache no problem. Am I missing something?

Comments

Coupon Code Swap’s picture

After doing a bunch more searching and looking at different configurations, I was finally able to piece together the necessary configuration adjustments that needed to be made in order to get Secure Pages working with Nginx. The previous two config suggestions were not necessary in my case. I am running CentOS 6.5 with Nginx 1.0.15. Here's what I did:

1. add to: /etc/nginx/nginx.conf
map $scheme $https {default '';https on;}

2. add to: /etc/nginx/sites-available/example.com.vhost

location ~ \.php$ {...
+ fastcgi_param HTTPS $https;
}

There is another configuration option that may work if you are using a later version of Nginx that is mentioned here:

https://groups.drupal.org/node/206813#comment-682098

Perhaps this info could be added to the project page as a reference. If anyone has any questions or needs help getting Secure Pages working with Nginx, feel free to ask.

Coupon Code Swap’s picture

Component: Code » Documentation
Category: Bug report » Support request