WebFaction
Community site: login faq

I want to create a custom nginx instance to reverse proxy with my gunicorn.

I am currently using the shared nginx instance but am unsure how to proceed. I have my custom nginx app installed, not sure how I am supposed to tied them together. Any help would be appreciated.

asked 26 Jul '15, 06:23

solaris989
113
accept rate: 0%

Can you clarify a bit? Specifically, are you intending to place a custom nginx instance between the shared nginx instance and gunicorn (creating three layers instead of two?) Or, do you want to create a custom Nginx instance listening on a high-numbered port open in the firewall, which proxies to your application (two layers)?

(26 Jul '15, 09:40) ryans ♦♦

I want 2 layers only, my custom nginx listening with my gunicorn behind it

(26 Jul '15, 17:06) solaris989

the reason i want this is because i moved over from apache but i still want all my custom rewrite rules

(26 Jul '15, 17:07) solaris989

So i figured it out on my own.

Used this website to setup my nginx properly: https://jamie.curle.io/posts/webfaction-installing-custom-nginx/

Then I setup a proxy_pass:

   location / {
        try_files $uri @gunicorn;
   }

    location @gunicorn {
        proxy_redirect            off;
        proxy_set_header          Host $host;
        proxy_set_header          X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header          X-Real-IP $remote_addr;
        proxy_pass                http://127.0.0.1:{my gunicorn port};
    }
permanent link

answered 26 Jul '15, 18:15

solaris989
113
accept rate: 0%

edited 26 Jul '15, 18:16

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×906
×186
×33
×32
×12

question asked: 26 Jul '15, 06:23

question was seen: 2,591 times

last updated: 26 Jul '15, 18:16

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM