<div dir="ltr">Hi All<div><br></div><div>I am a newbie with nginx server. I am trying to get websocket configuration working on cent-os.(linux 2.6.32-358.18.1.el6.x86_64). Following is my nginx config file;</div><div><br></div>
<div><div>http {</div><div> include mime.types;</div><div> default_type application/octet-stream;</div><div><br></div><div> #log_format main '$remote_addr - $remote_user [$time_local] "$request" '</div>
<div> # '$status $body_bytes_sent "$http_referer" '</div><div> # '"$http_user_agent" "$http_x_forwarded_for"';</div><div><br></div><div>
#access_log logs/access.log main;</div><div><br></div><div> sendfile on;</div><div> #tcp_nopush on;</div><div><br></div><div> #keepalive_timeout 0;</div><div> keepalive_timeout 65;</div><div>
<br></div><div> #gzip on;</div><div><br></div><div> server {</div><div> listen 80;</div><div> server_name localhost;</div><div><br></div><div> #charset koi8-r;</div><div><br></div><div> #access_log logs/host.access.log main;</div>
<div><br></div><div> location / {</div><div> root html;</div><div> index index.html index.htm;</div><div> <b> proxy_pass <a href="http://localhost:80">http://localhost:80</a></b>;</div>
<div> proxy_http_version 1.1;</div><div> <b>proxy_set_header Upgrade $http_upgrade;</b></div><div><b> proxy_set_header Connection "upgrade";</b></div><div><b> proxy_set_header Host $host;</b></div>
<div> proxy_read_timeout 3600;</div><div> proxy_send_timeout 3600;</div><div> }</div><div><br></div><div> #error_page 404 /404.html;</div><div> location / {</div><div>
# root html;</div><div> # index index.html index.htm;</div><div> # }</div><div> #}</div><div><br></div><div><br></div><div> # HTTPS server</div><div> #</div><div> #server {</div><div>
# listen 443;</div><div> # server_name localhost;</div><div><br></div><div> # ssl on;</div><div> # ssl_certificate cert.pem;</div><div> # ssl_certificate_key cert.key;</div>
<div><br></div><div> # ssl_session_timeout 5m;</div><div><br></div><div> # ssl_protocols SSLv2 SSLv3 TLSv1;</div><div> # ssl_ciphers HIGH:!aNULL:!MD5;</div><div> # ssl_prefer_server_ciphers on;</div>
<div><br></div><div> # location / {</div><div> # root html;</div><div> # index index.html index.htm;</div><div> # }</div><div> #}</div><div><br></div><div>}</div><div><br></div><div><br>
</div><div style>With above configuration, and with proxy_pass set, it gices 502 error. When I try to access </div><div style>ws://<a href="http://127.0.0.1:80">127.0.0.1:80</a> using chrome websocket client.</div><div style>
<br></div><div style>I will highly appreciate if someone can give right pointer to resolving this.</div><div style><br></div><div style>Thanks a ton</div><div style><br></div><div style>Hemant</div><div><br></div></div></div>