1. 实现效果
打开浏览器,在浏览器地址栏输入地址 www.123.com,跳转到 liunx 系统 tomcat 主页面中。
2. 准备工作
(1)在 liunx 系统安装 tomcat,使用默认端口 8080
* tomcat 安装文件放到 liunx 系统中,解压
* 进入 tomcat 的 bin 目录中,./startup.sh 启动 tomcat 服务器
(2)对外开放访问的端口
firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd –reload
查看已经开放的端口号
firewall-cmd --list-all
(3)在 windows 系统中通过浏览器访问 tomcat 服务器
3. 访问过程分析
4. 具体配置
第一步 在 windows 系统的 host 文件进行域名和 ip 对应关系的配置
第二步 在nginx上进行请求转发的配置(反向代理的配置)
server {
listen 80;
server_name 190.16.4.68;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
proxy_pass http://127.0.0.1:8080;
index index.html index.html;
}