修改tomcat的配置
1、找到tomcat的安装目录,**\apache-tomcat-9.0.14\conf\server.xml中找到host节点
<Host name="ceel.vip" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="C:/ceel/apache-tomcat-9.0.14/webapps/demo" debug="0" reloadable="true" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
</Host>
<Host name="cc.ceel.vip" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context path="" docBase="C:/ceel/apache-tomcat-9.0.14/webapps/wallpaper" debug="0" reloadable="true" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
</Host>
注意:
Host 的name属性值是你的二级域名。例如我的 cc.ceel.vip
Context的docBase 属性值是 你的二级域名要对应项目的绝对路径。 例如我的: C:/ceel/apache-tomcat-9.0.14/webapps/wallpaper
这里有多少个二级域名,就复制多少个host节点,并且像上面一样编辑2个地方即可。
保存文件,然后重启tomcat。
重启完成后先验证一下:访问对应的二级域名加上8080端口访问自己的 tomcat的配置成功了没有。
开始nginx的设置了:
找到nginx的安装目录**\nginx-1.17.0\conf\nginx.conf, 添加server监听
server {
listen 80;
server_name cc.ceel.vip;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://cc.ceel.vip:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
先把原有的server复制一份,添加在原有的server下面,然后重启nginx。
server的配置和tomcat的一样,有多少个二级域名就添加多少次server
参考:https://blog.csdn.net/jioho_chen/article/details/81509784
751

被折叠的 条评论
为什么被折叠?



