Hello!
I'm trying to run vibe application behind nginx http server.
My stuff:
////app.d
import vibe.d;
void index(HttpServerRequest req, HttpServerResponse res) {
res.render!("index.dt");
}
static this() {
auto router = new UrlRouter;
router.get("/", &index);
auto settings = new HttpServerSettings;
settings.bindAddresses = [
"127.0.0.1"
];
settings.port = 6174;
listenHttp(settings, router);
}
////
/////etc/nginx/sites-enabled/mydomain.com
server {
listen 80;
server_name .mydomain.com;
access_log /var/www/mydomain.com/log/access.log;
error_log /var/www/mydomain.com/log/error.log;
location / {
auth_basic "Success Denied";
auth_basic_user_file /var/www/mydomain.com/.htpasswd;
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_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:6174;
proxy_redirect off;
}
}
////
After that, then i type http://mydomain.com in my browser,
response from nginx is 504 Gateway Timout.
But then i comment out the bindAddresses assigning and type
http://xx.xx.xx.xx:6174 (where xx.xx.xx.xx is an IP of the actual
server machine), all is ok.
Similar configs successfully work with node.js applications.
Does anyone know where i'm wrong?
Thanx.
Stanislav