首先在阿里云配置解析域名

node-nginx二级域名添加配置-LMLPHP

指向端口为3200的nodejs服务,在nginx/conf.d下增加文件chat.conf,内容如下:

server {
listen 80; server_name www.chat.sanjiadian.net chat.sanjiadian.net; location / {
proxy_pass http://127.0.0.1:3200;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

注意nginx/nginx.conf文件中的http下包含:include /etc/nginx/conf.d/*.conf;实际根据自己的nginx安装目录

重启nginx

05-26 12:12