1.nginx服务器的安装
sudo apt-get install nginx
2.nginx服务器的启动
sudo /etc/init.d/nginx start
3.多域名对应不同的后台服务器
在/etc/nginx/sites-enabled/ 目录中删除default配置文件
新建域名对应的配置文件
比如test.youlunshidai.com
#通过upstream nodejs__upstream 可以配置多台nodejs节点,做负载均衡
upstream nodejs__upstream__test__youlunshidai {
server 127.0.0.1:8089; #服务器地址和端口号
#server 127.0.0.1:8088; #负载均衡服务器地址和端口号
keepalive 64; #设置存活时间。如果不设置可能会产生大量的timewait
}
server {
listen 80;
server_name test.youlunshidai.com;
access_log /var/log/nginx/test_youlunshidai.log; #nginx日志文件
location / {
proxy_set_header x-real-ip $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header host $http_host;
proxy_set_header x-nginx-proxy true;
proxy_set_header connection "";
proxy_http_version 1.1;
proxy_pass http://nodejs__upstream__test__youlunshidai; #反向代理转发 http://nodejs__upstream;
}
}如果还有其他域名和后台服务器,在目录下继续新建对应的域名配置文件即可

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号