redhat 6.2(x64) 配置tomcat+nginx
来源:互联网 发布:小米mix2全球网络制式 编辑:程序博客网 时间:2024/06/02 00:40
nginx常用命令:
重启:/usr/local/nginx/sbin/nginx -s reload
启动:/usr/local/nginx/sbin/nginx
关闭:/usr/local/nginx/sbin/nginx -s stop
验证配置文件是否正确:/usr/local/nginx/sbin/nginx -t
1、安装jdk:jdk-6u31-linux-i586-rpm.bin(先加权限再执行)
2、安装tomcat:apache-tomcat-6.0.35.zip(解压缩,然后chmod a+x /tomcat/bin/*.sh)就可以在8080端口启动;
3、下载pcre:ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 安装pcre,configure ,make ,make install
4、安装nginx,下载nginx-1.2.0.tar.gz,然后
./configure --without-http_gzip_module
make
make install
安装在了/usr/local/nginx/下面;
启动时发生错误 :
/usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
--解决方案:ln -s /usr/local/lib/libpcre.so.1 /lib64
再次启动,ok了
5、新建/www cp -rf /tomcat/webapps /www (必须做的)
6、修改tomcat中的 conf/server.xml
appBase="webapps”,修改为appBase=“/www”,其中/www 即为网页的根目录。
7、修改/usr/local/nginx/conf/nginx.conf
加下划线部分为添加的;斜体部分为修改的
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
use epoll;
worker_connections 51200;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
tcp_nodelay on;
client_body_buffer_size 512k;
proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
upstream tomcat_server {
server 127.0.0.1:8080;
}
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
index index.html index.htm index.jsp index.do default.jsp default.do index.php;
root /www;
#access_log logs/host.access.log main;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
if (-d $request_filename)
{
rewrite ^/(.*)([^/])$http://$host/$1$2/ permanent;
}
location ~ \.(jsp|jspx|do|wsdl)?$ {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://tomcat_server;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
}
include vhost/*.conf;
}
具体文件:
8、重启nginx:/usr/local/nginx/sbin/nginx -s reload
参考资料:http://www.iteye.com/topic/1120937
- redhat 6.2(x64) 配置tomcat+nginx
- CentOS 6.5 X64 JAVA环境配置(JDK+TOMCAT+NGINX)
- Tomcat安装配置(win10 x64)
- RedHat(RHEL)6.2 X64 Oracle11g X64 安装参考文档
- Nginx+Tomcat配置Tomcat集群
- nginx+tomcat配置
- 配置nginx+tomcat
- nginx+tomcat 配置相关
- Nginx+tomcat 配置
- Nginx+tomcat配置集群
- Nginx+Tomcat配置
- Nginx+tomcat配置集群
- startssl tomcat nginx 配置
- Nginx+tomcat配置集群
- JDK tomcat nginx配置
- Nginx + Tomcat + Terracotta配置
- nginx+tomcat集群配置
- 配置nginx+tomcat
- 跨域访问
- (较难)Battery Charging(CDOJ1647)
- SQLServer数据库压缩
- C# 优先采用foreach循环语句
- 1000~2000内能被17与37同时整除的数
- redhat 6.2(x64) 配置tomcat+nginx
- 分苹果问题
- SAP ALV 详细说明 .
- 视频采集的基本流程
- 【Tiny6410 And Linux】—(1.4)—device 设备模型——代码
- 三个数大小的比较
- C#多线程之 任务工厂
- javascript 编程风格
- Spring MVC 文件上传下载