Nginx的配置文件:

nginx安装目录/conf/nginx.conf

重新加载配置文件

./nginx -s reload

配置虚拟主机

一个server就是一台虚拟主机

 server {
        listen       80;//监听端口
        server_name  localhost;//域名

        location / {
            root   html;
            index  index.html index.htm;
        }
 }

反向代理与负载均衡

upstream tomcat {
	server ip1:端口号1 weight=2;
	server ip2:端口号2 weight=2;//权重
}
 server {
        listen       80;//监听端口
        server_name  www.test.com;//域名

        location / {
            proxy_pass   http://tomcat;
            index  			index.html index.htm;
        }
 }

相关文章:

  • 2021-11-11
  • 2022-12-23
  • 2021-07-27
  • 2021-11-14
  • 2021-06-28
  • 2021-10-07
  • 2018-05-12
  • 2021-11-06
猜你喜欢
  • 2021-06-05
  • 2021-11-26
  • 2021-12-08
  • 2021-12-02
  • 2021-11-27
  • 2022-02-10
  • 2022-01-05
相关资源
相似解决方案