vendredi 17 avril 2015

Setting up nginx for socket-io and nodejs

I have a project which did not require socket-io till now, with following nginx configuration



server {
server_name app.web.com;
root /var/www/app/releases/current/public/;
index index.html index.htm;

access_log /var/log/nginx/app.access.log;
error_log /var/log/nginx/app.error.log;
underscores_in_headers on;

recursive_error_pages on;
error_page 503 @maintenance;

if (-f $document_root/system/maintenance.html) {
return 503;
}

location @maintenance {
error_page 405 = /system/maintenance.html;
rewrite ^(.*)$ /system/maintenance.html break;
}

location ~ ^/(js|css|images|media|system)/ {
autoindex off;
add_header Cache-Control public;
expires 4w;
}

location / {
try_files $uri $uri/index.html @proxy;
}

location @proxy {
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:7485;
}
}


Now I have added a chat feature in it using socket-io. How do I add enable socket from nginx?


Aucun commentaire:

Enregistrer un commentaire