Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>If you actually want to redirect (301 or 302) your web traffic</h2> <p>You create a <code>server {}</code> section listening on port 3000 and you just redirect it to another <code>server {}</code> section that is listening on port 80. In each <code>server {}</code> section set the <code>listen</code> property appropriately. I guess you are trying to handle the redirection within à single <code>server</code> section and according to <a href="http://wiki.nginx.org/HttpCoreModule#listen" rel="nofollow">this page</a> the <code>listen</code> directive applies to a <code>server</code> context</p> <h2>If you want to use nginx as a proxy</h2> <p>Then what you are looking for is the proxy_pass directive. Here is a sample configuration extracted from an config I have to use nginx as a proxy for my rails app (thin). Basically my app runs locally (but it would also work on a remote host) on port 3200 and the relevant nginx config part looks as follow:</p> <pre><code> upstream my-app-cluster { server localhost:3200; } server { listen 80; server_name mydomain.com; root /root/to/public/folder; access_log /my/app/log/folder/myapp.log; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; if (-f $request_filename/index.html) { rewrite (.*) $1/index.html break; } if (-f $request_filename.html) { rewrite (.*) $1.html break; } if (!-f $request_filename) { proxy_pass http://my-app-cluster; break; } } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload