nginx как reverse proxy

Конфигурация nginx без ssl

server {
    listen 80;
    server_name mydomain.com;

    location / {
	proxy_pass http://127.0.0.1:8080/;
	proxy_set_header   X-Real-IP $remote_addr;
	proxy_set_header   Host $host;
	proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    }																							    
}

Конфигурация nginx с ssl

server {
 listen 80;
 server_name mydomain.com;
 return 301 https://$server_name$request_uri; # enforce https
}

server {
        listen            443;
        server_name       mydomain.com;

        access_log       /var/log/nginx/ssl-access.log;

        ssl                     on;
        ssl_protocols           SSLv3 TLSv1;
        ssl_certificate         /etc/nginx/ssl/cert.pem;
        ssl_certificate_key     /etc/nginx/ssl/cert.key;

        location / {
                proxy_pass            https://127.0.0.1:8080/;
                proxy_redirect        off;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For      $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;
                proxy_pass_header Set-Cookie;
        }
}