Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Nginx ssl reverse proxy 502
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Nginx ssl reverse proxy 502

Hello everyone,

I'm using apache in centos at port 443 and my domain load perfectly, but due to high load i need to use nginx as reverse proxy unfortunately i'm unable to use it with ssl (port 80 load fine)

here is my nginx conf


server {
listen myip:443;
server_name mydomain.com;
ssl on;
ssl_certificate /etc/httpd/ssl/mydomain.crt;
ssl_certificate_key /etc/httpd/ssl/mydomain.key;
error_log /var/log/httpd/mydomain.com.error.log error;
index index.php index.html index.htm;
root /home/mydomain/www;

location / {
    proxy_pass https://ip:8082;
    proxy_redirect off; 
proxy_set_header Host $host; 
proxy_set_header X-Real-IP $remote_addr; 
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
proxy_max_temp_file_size 0;
    proxy_read_timeout  90;

}

}

Comments

  • babuumbabuum Member
    edited January 2016

    Paste your error log...

    Also this config won't help against your high load problem.

    EDIT:

    proxy_pass https://ip:8082;

    Do you really need ssl to your backend?

  • robohost said: due to high load i need to use nginx as reverse proxy

    Why dont you just use nginx

    nginx ftw, apache to the bin.

  • @babuum said:
    Paste your error log...

    Also this config won't help against your high load problem.

    If i don't use https it will lead to 400 error

    @rokok said:
    nginx ftw, apache to the bin.

    Our website is still under development mas bro, i think it will faster to edit .htacess than edit nginx config this time

  • kingpinkingpin Member
    edited January 2016

    I would invoke strace on both sides and look what is going on behind the scenes.

    It came in handy when I was debugging 403 Forbidden error which started to appear all of a sudden after updating the nginx and php-fpm configs.

    Turned out index index.php nginx directive wasn't in effect for some reason on a directory, and I saw nginx probing for index.htm, index.html files via system calls, but not for index.php.

    stat("/foo/index.html", 0x7ffd6072e210) = -1 ENOENT (No such file or directory)
    
    stat("/foo/index.htm", 0x7ffd6072e210) = -1 ENOENT (No such file or directory)
    
    write(4, "2015/12/09 19:25:05 [error] 13367#0: *9 directory index of \"/foo/\" is forbidden, client: aa.bb.cc.dd, server: example.com, request: \"GET / HTTP/1.1\", host: \"example.com\"\n", 233) = 233
    

    You just need to identify the pid of your running web server or proxy and then attach to the program.

    sudo strace -s 512 -p 1337
    

    Where 1337 is your process number.

  • @rokok said:
    nginx ftw, apache to the bin.

    There's a really bad Linux joke in here somewhere.

    Thanked by 1jemaltz
  • NeoonNeoon Community Contributor, Veteran

  • robohost said: error_log /var/log/httpd/mydomain.com.error.log error;

    You should use it... and if you want help provide it to us.

  • @babuum said:

    sorry forget to give it


    Re-negotiation handshake failed: Not accepted by client!?

Sign In or Register to comment.