centos上面nginx 反向代理 tomcat

酷

首先保证tomcat已经安装在本机且使用默认端口8080。

--安装nginx

1. yum install gcc-c++

2. yum install pcre pcre-devel

3. yum install zlib

4. yum install openssl openssl-devel

5. yum install nginx

--配置nginx

vim /etc/nginx/nginx.conf

在Server括号里找到空的location括号,location段填写成如下内容

location / {

root html;

index index.html index.htm;

proxy_pass http://localhost:8080

}

保存刚才的修改。

--启动nginx

service nginx start

--测试反向代理

用手机浏览器输入服务器外网IP地址回车,出现tomcat欢迎页面即可。

猜你喜欢

转载自johnsmith9th.iteye.com/blog/2410834