Renginx如何只负责反向代理?
感觉楼主真多此一举
nginx可以直接运行静态和php,还可以反代tomcat 要apache做什么,nginx跑php也比apache强很多
我的环境就是tengine+resin组合,和nginx+tomcat 没区别
具体怎么做,就把tomcat和nginx的应用目录设置成1个目录,当然,不设置1个目录也行,设置成1个目录最好,不过要用同一个用户运行nginx和tomcat
然后在nginx和tomcat绑定同1个域名
nginx简单点的反代
server {
server_name_in_redirect off;
listen 80;
server_name 123.com;
include drop_sql.conf;
location / {
proxy_pass http://123.com:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /(WEB-INF)/ {
deny all;
}
access_log /dev/null;
error_log /dev/null;
}
你想静动分离就把location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 等等加进去