博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx配置多域名单ip访问不同目录不同应用
阅读量:7082 次
发布时间:2019-06-28

本文共 1085 字,大约阅读时间需要 3 分钟。

hot3.png

首先安装 nginx

sudo apt-get install nginx

修改 nginx 配置文件 /etc/nginx/nginx.conf , 这里只是修改其中http部分 : 

http {    include       mime.types;    default_type  application/octet-stream;    sendfile        on;    keepalive_timeout  65;	    upstream www.ccc.com {          server 192.168.1.10:8080;          }      upstream www.bbb.com {          server 192.168.1.10:8081;    }	    server {        listen       80;        server_name  www.aaa.com;        location / {            index  index.html index.jsp;                proxy_pass  http://www.aaa.com;                proxy_set_header    X-Real-IP   $remote_addr;                client_max_body_size    100m;         }		    }	    server {        listen       80;        server_name www.bbb.com;        location / {            index  index.html index.jsp;                proxy_pass  http://www.bbb.com;                proxy_set_header    X-Real-IP   $remote_addr;                client_max_body_size    100m;         }    }}

可以配合tomcat实现 nginx+tomcat单IP, 多域名, 多站点的访问

测试的时候可以在hosts文件中虚拟两个域名假设为两实例中的站点的域名. 

转载于:https://my.oschina.net/imhuayi/blog/475552

你可能感兴趣的文章
java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory的解决办法
查看>>
NGUI类关系图
查看>>
【java集合框架源码剖析系列】java源码剖析之HashSet
查看>>
【java】spring项目中 对entity进行本类间的克隆
查看>>
JSP常用标签
查看>>
剑指offer-斐波那契数列07
查看>>
Google Cloud Platfrom中使用Linux VM
查看>>
Hystrix框架1--入门
查看>>
logback 和 log4j对比,及相关配置
查看>>
iOS 音乐播放器之锁屏效果+歌词解析
查看>>
java中int->String 3种方式效率分析
查看>>
从 Python 快速启动 CGI 服务器
查看>>
php 二维数组转一维数组
查看>>
「POJ3734」Blocks
查看>>
Beta 冲刺 (4/7)
查看>>
CSS3
查看>>
VGG16提取图像特征 (torch7)
查看>>
Python 远程部署 Fabric
查看>>
1013A.Piles With Stones
查看>>
multipart/form-data和application/x-www-form-urlencoded的区别
查看>>