三、配置nginx和resin
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
vi /usr/local/nginx/conf/nginx.conf
# 找到server部分,将其修改如下
server { listen 80; server_name localhost; root /usr/local/wwwweb; #charset koi8-r; #access_log logs/host.access.log main; location / { access_log on; proxy_pass :8080; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; #root html; #index index.html index.htm; }
cp /usr/local/resin/conf/resin.xml /usr/local/resin/conf/resin.xml.bak
vi /usr/local/resin/conf/resin.xml
<host id="" root-directory="/usr/local/wwwweb"> <!-- - webapps can be overridden/extended in the resin.xml --> <web-app id="/" root-directory="xuad"/>
mkdir /usr/local/wwwweb
mkdir /usr/local/wwwweb/xuad
四、测试
vi /usr/local/wwwweb/xuad/index.jsp
<h1>hello word </h1>
service nginx restart
service resin restart
在浏览器地址栏里输入,如果能正常显示“hello word”页面,则表示nginx和resin整合成功。
我们在装nginx之前有装pcre和ngx_cache_purge,如果想用nginx做负载均衡或者做缓存的话,可以参考我的另一篇:CentOS 5.8部署nginx+keepalived实现负载均衡 。关于反向代理的话只需要稍微修改一下配置文件而已,这里我就不讲了。