# Enabeling SSL causes Redirect Loop errors?

**URL:** <https://www.ruby-forum.com/t/enabeling-ssl-causes-redirect-loop-errors/211753>\
**Category:** NGINX\
**Created:** [September 13, 2011, 4:11am UTC](https://www.ruby-forum.com/t/enabeling-ssl-causes-redirect-loop-errors/211753 "2011-09-13T04:11:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [September 13, 2011, 4:11am UTC](https://www.ruby-forum.com/t/enabeling-ssl-causes-redirect-loop-errors/211753/1 "2011-09-13T04:11:04Z")

</div>

## I am new to Nginx but learning every day. I have the server setup nicely and the regular webpages serve up fine. I have multiple IP’s on the server (less than 20) and I am trying to enable SSL for 3 different sites (each on a different IP). I have read for hours looking at examples and trying many different things to see if I can get the SSL pages to serve up and no luck. I am hoping someone can help me. Running debian lenny, nginx 1.0.6, php 5.3.8, php-fpm, I am only wanting to run one domain SSL per IP, (Bogus domain name has been inserted below)

nginx.conf

user www-user;  
worker\_processes 4;  
pid /var/run/nginx.pid;

events {  
worker\_connections 768;  
# multi\_accept on;  
}

http {

```
    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 60 60;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    gzip_vary on;
    # gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json

```

application/x-javascript text/xml application/xml application/xml+rss  
text/javascript;

```
    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

```

}

* * *

> include /etc/nginx/conf.d/\*.conf;

There NO conf files located in the above folder. I have not set up any  
site specific conf files yet.

* * *

vhost entry (one try)

server {  
listen 80;  
listen 206.201.217.7:443 ssl;  
server\_name [www.luvinlife.com](http://www.luvinlife.com) [luvinlife.com](http://luvinlife.com);

```
    ssl_certificate /usr/nginx/certs/luvinlife.pem;
    ssl_certificate_key /usr/nginx/certs/luvinlife.key;

    client_max_body_size 5m;

    root /var/www/luvinlife.com/public_html;
    try_files $uri $uri/ /index.php?$args;
    index index.html index.php;

    location ~ \.php$ {
        #fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME

```

$document\_root$fastcgi\_script\_name;  
}  
}

* * *

version check :

nginx: nginx version: nginx/1.0.6  
nginx: TLS SNI support enabled  
nginx: configure arguments: --prefix=/etc/nginx  
–conf-path=/etc/nginx/nginx.conf  
–error-log-path=/var/log/nginx/error.log  
–http-client-body-temp-path=/var/lib/nginx/body  
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi  
–http-log-path=/var/log/nginx/access.log  
–http-proxy-temp-path=/var/lib/nginx/proxy  
–http-scgi-temp-path=/var/lib/nginx/scgi  
–http-uwsgi-temp-path=/var/lib/nginx/uwsgi  
–lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid  
–with-debug --with-http\_addition\_module --with-http\_dav\_module  
–with-http\_geoip\_module --with-http\_gzip\_static\_module  
–with-http\_image\_filter\_module --with-http\_realip\_module  
–with-http\_stub\_status\_module --with-http\_ssl\_module  
–with-http\_sub\_module --with-http\_xslt\_module --with-ipv6  
–with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl  
–with-mail --with-mail\_ssl\_module  
–add-module=/usr/src/nginx/source/nginx-1.0.6/debian/modules/nginx-echo  
–add-module=/usr/src/nginx/source/nginx-1.0.6/debian/modules/nginx-upstream-fair

* * *

SSL Page Error message:

The webpage at [https://www.luvinlife.com/index.php/customer/account/](https://www.luvinlife.com/index.php/customer/account/) has  
resulted in too many redirects. Clearing …

Posted at Nginx Forum:

> **[Enabeling SSL causes Redirect Loop errors ???](https://forum.nginx.org/read.php?2,215136,215136#msg-215136)**
>
> I am new to Nginx but learning every day. I have the server setup nicely and the regular webpages serve up fine. I have multiple IP's on the server (less than 20) and I am trying to enable SSL for 3 different sites (each on a different IP). I have...

---

<div class="post-metadata">

**Author:** ![doughboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bcef8e/32.png) [@doughboy](https://www.ruby-forum.com/u/doughboy)\
**Post date:** [September 21, 2011, 3:05pm UTC](https://www.ruby-forum.com/t/enabeling-ssl-causes-redirect-loop-errors/211753/2 "2011-09-21T15:05:20Z")

</div>

There are two things to be aware of here:

1. fastcgi\_param HTTPS on; - add this to your location ~ .php$ {}.
2. If you use php-fpm chroot set:  
fastcgi\_param SCRIPT\_FILENAME $fastcgi\_script\_name;  
fastcgi\_param PATH\_TRANSLATED $fastcgi\_script\_name;  
Thats because your document root will be just /, but only if your chroot  
dir = your actual site dir.

Posted at Nginx Forum:

> **[Re: Enabeling SSL causes Redirect Loop errors ???](https://forum.nginx.org/read.php?2,215136,215505#msg-215505)**
>
> I am new to Nginx but learning every day. I have the server setup nicely and the regular webpages serve up fine. I have multiple IP's on the server (less than 20) and I am trying to enable SSL for 3 different sites (each on a different IP). I have...
