nginx反向代理实例1

实现效果:通过nginx的80端口访问到tomcat的8080端口

1. 安装tomcat

参考:https://blog.csdn.net/BOOM_haha/article/details/103345117

2. 安装nginx

参考:https://blog.csdn.net/BOOM_haha/article/details/103310889

3. 配置nginx

vim /usr/local/nginx/conf/nginx.conf
 server {
        listen       80;
        server_name  192.168.56.101; #此处ip为机器网络ip

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            proxy_pass http://127.0.0.1:8080; #映射到本地8080端口
            index  index.html index.htm;
        }
......
......
}
# 重载nginx配置文件
./nginx -s reload
发布了21 篇原创文章 · 获赞 6 · 访问量 852

猜你喜欢

转载自blog.csdn.net/BOOM_haha/article/details/103345022