Cần cấu hình như sau:
server { listen xx.xx.xx.xx:443 ssl; server_name socketio.nentang.vn www.socketio.nentang.vn; ssl_certificate /home/admin/conf/web/ssl.socketio.nentang.vn.pem; ssl_certificate_key /home/admin/conf/web/ssl.socketio.nentang.vn.key; error_log /var/log/httpd/domains/socketio.nentang.vn.error.log error; location / { proxy_pass http://xx.xx.xx.xxx:PORT; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; #enable Web socket proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ { root /home/admin/web/socketio.nentang.vn/public_html; access_log /var/log/httpd/domains/socketio.nentang.vn.log combined; access_log /var/log/httpd/domains/socketio.nentang.vn.bytes bytes; expires max; try_files $uri @fallback; } } location /error/ { alias /home/admin/web/socketio.nentang.vn/document_errors/; } location @fallback { proxy_pass http://xx.xx.xx.xx:PORT; } location ~ /\.ht {return 404;} location ~ /\.svn/ {return 404;} location ~ /\.git/ {return 404;} location ~ /\.hg/ {return 404;} location ~ /\.bzr/ {return 404;} include /home/admin/conf/web/snginx.socketio.nentang.vn.conf*; }