在CentOS linux 正常配置 tomcat7
来源:互联网 发布:sql 最后一行显示合计 编辑:程序博客网 时间:2024/06/18 12:00
安装中文包支持
yum groupinstall chinese-support
在CentOS linux 正常配置 tomcat7
启动tomcat7,访问地址为:
192.168.1.207:8080
192.168.1.208:8080
- 下载nginx 相关版本,地址如下:http://nginx.org/en/download.html,个人使用的是nginx-1.6.2.tar.gz
- 将nginx 安装文件上传至linux 服务器。
- 执行命令进行解压:tar -zxvf nginx-1.6.2.tar.gz
- 安装nginx必须的相关包命令:
- yum install -y pcre-devel openssl-devel
- yum install gcc-c++
配置nginx安装环境:
执行如下命令:
- cd nginx-1.6.2
- ./configure --with-http_stub_status_module --with-http_ssl_module
如果出现以下信息表示配置安装环境成功。
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
安装nginx
执行命令:make && make install
出现如下信息表示安装成功:
test -f '/usr/local/nginx/conf/nginx.conf' || cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf'
cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html' || cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs'
make[1]: Leaving directory `/web/nginx-1.6.2'
启动:/usr/local/nginx/sbin/nginx
关闭:/usr/local/nginx/sbin/nginx -s stop
关闭:/usr/local/nginx/sbin/nginx -s stop
重启 nginx 服务:/usr/nginx/sbin/nginx -s reload
配置nginx负载均衡
执行命令:vi /usr/local/nginx/sbin/nginx/conf/nginx.conf
修改为:
worker_processes 2;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#start
upstream 192.168.1.208{
#解决session的问题
ip_hash;
server 192.168.1.207:8080 weight=1;
server 192.168.1.208:8080 weight=1;
}
#end
server {
listen 80;
server_name 192.168.1.208;
location / {
root html;
index index.html index.htm;
#请求转向mysvr 定义的服务器列表
proxy_pass http://192.168.1.208;
proxy_redirect default;
#跟代理服务器连接的超时时间,必须留意这个time out时间不能超过75秒,当一台服务器当掉时,过10秒转发到另外一台服务器。
proxy_connect_timeout 10;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#start
upstream 192.168.1.208{
#解决session的问题
ip_hash;
server 192.168.1.207:8080 weight=1;
server 192.168.1.208:8080 weight=1;
}
#end
server {
listen 80;
server_name 192.168.1.208;
location / {
root html;
index index.html index.htm;
#请求转向mysvr 定义的服务器列表
proxy_pass http://192.168.1.208;
proxy_redirect default;
#跟代理服务器连接的超时时间,必须留意这个time out时间不能超过75秒,当一台服务器当掉时,过10秒转发到另外一台服务器。
proxy_connect_timeout 10;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
保存退出。
启动nginx服务,
访问http://192.168.1.208/应用名称
0 0
- 在CentOS linux 正常配置 tomcat7
- centos配置tomcat7
- CentOS安装配置Tomcat7
- 在Linux Tomcat7怎样安装配置注册服务
- 在Tomcat7中配置数据源
- centos安装配置JDK1.7与Tomcat7
- CentOS 6.5 安装配置Tomcat7服务器
- CentOS 6.5 安装配置Tomcat7服务器
- CentOS 7环境配置tomcat7开机启动
- CentOs上tomcat7安装及配置
- CentOS 6.5 安装配置Tomcat7服务器
- linux CentOS 6.5 下安装jdk1.7, tomcat7.0环境配置
- Tomcat7安装与配置,linux
- Tomcat7安装与配置,linux
- linux Tomcat7 配置及常见问题
- linux下tomcat7虚拟目录配置
- Linux centos (vps) 安装Tomcat7
- CentOS Linux release 7.2.1511安装Tomcat7
- 11个免费的Web安全测试工具
- 每个程序员和设计师可做的10项运动
- 2015-7-30 我的博客
- 离散事件模拟-银行管理
- 纯css解决position:abusolute的div居中显示
- 在CentOS linux 正常配置 tomcat7
- 挑战世界顶级十七项编程
- sencha touch Ext.date.monthNames
- CharSequence与String的区别是什么
- 鸣人和佐助
- 使用highcharts插件时图表无法显示且jQuery报错:Uncaught ReferenceError: $ is not defined
- 读书笔记17:桥接模式
- 充实的每一天
- 九度oj 1442