Setting up Nginx as a reverse proxy

dariusc93 edited this page Nov 21, 2014 · 4 revisions

To put vibe.d behind an nginx proxy, at least version 1.1.x of nginx is required as the proxy module needs to support HTTP/1.1. The following configuration provides a minimal example for the fields that should be present.

server {
    listen    80;
    server_name www.example.com;

    location / {
        proxy_pass http://localhost:1234;
        proxy_redirect off;
        proxy_http_version 1.1;
        
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }
}