CORS in nginx

if ($request_method = 'OPTIONS') {
			add_header 'Access-Control-Allow-Origin' "$http_origin";
			add_header 'Access-Control-Allow-Credentials' 'true';
			add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,DELETE,OPTIONS';
			add_header 'Access-Control-Allow-Headers' 'Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Origin,Accept';
			add_header 'Content-Type' 'application/json';
			add_header 'Content-Length' 0;
 
			return 204;
		}
31 января 2017, 13:28

Nginx websocket configuration

location /chat {
proxy_pass http://node_app; 
proxy_http_version 1.1; 
proxy_set_header Upgrade $http_upgrade; 
proxy_set_header Connection "upgrade";
}
27 июля 2015, 02:00

Установка nginx в ubuntu 14.04

sudo apt-get install nginx-extras
sudo update-rc.d nginx enable
12 апреля 2015, 11:56