Learn about Centmin Mod LEMP Stack today
Register Now

Nginx Help setting a nginx reverse proxy

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by apidevlab, Apr 16, 2017.

  1. apidevlab

    apidevlab Member

    88
    30
    18
    Mar 22, 2016
    /dev/null
    Ratings:
    +54
    Local Time:
    1:28 PM
    1.11.1
    5.2.14-122
    I have installed semaphore and ansible with success, I created a vhost via option 2 and this is configured and working as it should.

    semaphore provide an example reverse proxy I am stupmed as to how I can merge this into the current centminmod produced ssl based .conf so I can use semaphore on the domain as set:

    Anyone care to help?
     
  2. eva2000

    eva2000 Administrator Staff Member

    28,952
    6,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,753
    Local Time:
    10:28 PM
    Nginx 1.13.x
    MariaDB 5.5
    looks like just this part of example reverse proxy goes into your centminmod nginx vhost domain.com.ssl.conf file with addition of proxy_http_version 1.1; line
    Code (Text):
    # disable any limits to avoid HTTP 413 for large image uploads
    client_max_body_size 0;
    # required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486)
    chunked_transfer_encoding on;
    
    location / {
      proxy_pass http://semaphore_api/;
      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;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_buffering off;
      proxy_request_buffering off;
      # this is necessary for us to be able to disable request buffering in all cases
      proxy_http_version 1.1;
    }
    
    location /api/ws {
      proxy_pass http://semaphore_api/api/ws;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_set_header Origin "";
    }
    

    and only this part of example goes into /usr/local/nginx/conf/nginx.conf which http{} context
    Code (Text):
    upstream semaphore_api {
    server semaphore_api:3000;
    }
    

    assuming proxy_pass defined upstream location is working (semaphore_api:3000)
    Code (Text):
    proxy_pass http://semaphore_api/;
    
     
  3. apidevlab

    apidevlab Member

    88
    30
    18
    Mar 22, 2016
    /dev/null
    Ratings:
    +54
    Local Time:
    1:28 PM
    1.11.1
    5.2.14-122
    assuming proxy_pass defined upstream location is working (semaphore_api:3000)
    Code (Text):
    proxy_pass http://semaphore_api/;
    


    Hi,
    I have not so far been able to merge them, I keep getting errors on ngxreload...

    Code (Text):
    Reloading nginx configuration (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
    


    As you highlighted proxy_http_version 1.1 do I need to update/install that on my box, it's not something I spotted?

    Also:
    assuming proxy_pass defined upstream location is working (semaphore_api:3000)
    Code (Text):
    proxy_pass http://semaphore_api/;
    


    If you mean do I have semaphore working on port 3000 the answer is yes.

    Will keep at it and read some more on the nginx/semaphore docs :)
     
    Last edited: Apr 16, 2017
  4. eva2000

    eva2000 Administrator Staff Member

    28,952
    6,572
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,753
    Local Time:
    10:28 PM
    Nginx 1.13.x
    MariaDB 5.5
    test nginx config to see where error is
    Code (Text):
    nginx -t
     
    • Like Like x 1