I'm trying to mimic my production environment on my dev server.

(Setup: LEMP server, Ubuntu Server LTS 12.04)

On my production site I use an SSL certificate from Gandi, it all works fine.

On my dev environment I created one myself following the instructions here:

I'm using the Secure Pages module to secure the admin area however when I enable HTTPS for a role (Administrator) I get a re-direct loop for all my pages which locks me out of my site.

HTTPS does however work fine for single pages.

Any ideas what I could be doing wrong? Could this be a config thing?

Instructions I used to generate an SSL

sudo openssl genrsa -des3 -out server.key 1024
sudo openssl req -new -key server.key -out server.csr
// Leave all options blank, except put address into common
sudo cp server.key server.key.org
sudo openssl rsa -in server.key.org -out server.key
sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Possible Relevant Nginx Config


 server {
      listen 443;

        root /srv/www/mysite/public
        ssl on;
        ssl_certificate /etc/nginx/ssl/testssl.crt;
        ssl_certificate_key /etc/nginx/ssl/testssl.key;

        location / {
           index  index.html index.htm index.php;
           error_page 404 = @drupal;

        location ~ \.php$ {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            if ($uri !~ "^/default/files/") {
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /srv/www/mysite/public$fastcgi_script_name;

        location @drupal {
            rewrite ^(.*)$ /index.php?q=$1 last;
  • It's probably your nginx conf (I had exactly the same problem setting this up a few days ago) - are you using something custom or is it based on Perusio's? Also have you applied the two core patches necessary to make securepages work? – Clive Nov 14 '13 at 14:59
  • @Clive That last part scares me. I've got secure pages "working" on my production site without any patches. Aren't the two on the module homepage only for the dev build?. I'm using a "custom" nginx conf, i.e. the basic one with slight alterations. – Dominic Woodman Nov 14 '13 at 16:45
  • Not in my experience - go to /admin/reports/updates on the live site and click 'Check manually'. If the batch job fails with a cryptic "No active batch" message, you're still in need of a patch – Clive Nov 14 '13 at 16:51
  • @Clive Nope that's all good. Thank god. So were you trying to get perusio's config to work with a self signed certificate, what was the issue in the end? – Dominic Woodman Nov 14 '13 at 17:00
  • Mea culpa, they have a new beta release. Didn't mean to worry you :P Yes I was using a self-signed cert (on a Mac but it shouldn't matter). Either the cert is valid or it's not, I can't think of a reason an invalid cert would cause a redirect loop. A config test fail, sure, but not a loop. Let me compare your vhost to mine, will let you know if there's an obvious difference...BTW this seems to be a common problem – Clive Nov 14 '13 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.