Nginx +Tomcat 配置 为什么使用 Nginx
Apache 经典的Web服务器 除了慢没有别的缺点了 Apache2对fcgi支持并不好 非常好用的proxy和proxy_ajp(很多人用它作为tomcat的前端) 不支持epoll(这年头,epoll几乎是性能的必备) Nginx 速度快,占用资源少 杀手级的proxy和rewrite 非常不错的静态文件能力 最适合作为整个网站的前端服务(将php、svn等不同请求发送往后端apache) 其他功能马马虎虎 代理 服务器,也是一个 IMAP/POP3/SMTP代理服务器
已经因为它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而被人们广泛使用了
大多数人选择它主要考虑到的是它的高并发和负载均衡
安装 Nginx 1
tar zxvf nginx0
gz 2、编译安装 nginx cd nginx-0
/configure --with-http_stub_status_module --with-http_ssl_module --prefix=/usr/local/nginx 执行后,可能会提示
/configure: error: the HTTP rewrite module requires the PCRE library
这个错误,是缺少pcre 包,可用yum install pcre pcre-devlel来解决 3、make && make install 4、nginx安装成功后的安装目录为/usr/local/nginx 5
编辑配置文件nginx
conf #user www www; worker_processes 8; #启动进程数,可根据机器核数来修改 error_log /usr/local