NGINX: Reverse Proxy (SSL) with non-ssl backend

Nelson Manuel Marques nelson-manuel-marques at
Mon May 26 09:11:27 UTC 2014


I currently run a small system which consists on an Apache HTTP with PHP (8080) backend (no SSL on localhost) with a Varnish HTTP accelerator on Port 9000 (localhost) and a NGINX reverse proxy (SSL).

I am facing a small issue with this setup, mainly, when I select checkboxes and friends and hit submit (ex; application setup) nothing happens… Boxes get unticket and I remain in the same screen. If bind Apache or Varnish on all interfaces and hit their ports directly, everything works. I believe this might be an issue with my nginx setup.

My nginx configuration (vhost, nginx.conf is the default):

server {
    listen                80;
    server_name           foobar.local;
    return 301            https://foobar.local/$request_uri;

server {
    listen                443 ssl;
    server_name           foobar.local;
   # virtual host error and access logs in /var/log/nginx
    access_log            /var/log/nginx/foobar.local-access.log;
    error_log             /var/log/nginx/foobar.local.vm-error.log;
    # gzip compression configuration
    gzip                  on;
    gzip_comp_level       7;
    gzip_min_length       1000;
    gzip_proxied          any;
    # SSL configuration; generated cert
    keepalive_timeout     60;
    ssl_protocols         SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_certificate       /etc/nginx/certs/self-ssl.crt;
    ssl_certificate_key   /etc/nginx/certs/self-ssl.key;
    ssl_session_cache     shared:SSL:5m;
    ssl_session_timeout   5m;
    ssl_prefer_server_ciphers  on;

    client_max_body_size 2M;

    location / {
        proxy_pass       ;
        add_header                 Front-End-Https   on;
        proxy_next_upstream        error timeout invalid_header http_500 http_502 http_503 http_504;
        #proxy_set_header           Accept-Encoding   "";
        proxy_set_header           Host            $http_host;
        proxy_set_header           X-Real-IP       $remote_addr;
        proxy_set_header           X-Forwarded-For $proxy_add_x_forwarded_for;
        allow     all;
        proxy_ignore_client_abort on;
        proxy_redirect             off;

More information about the nginx mailing list