如何在linux服务器上部署多个如何部署tomcat服务器

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)第三方登录:博客分类:
Linux 同台服务器上用ngnix配置两个tomcat的负载均衡
今天要在Linux服务器上做个负载均衡,于是从网上搜了许多资料,自己总结下来并成功实现
1.Linux上安装Java jdk
& a.执行安装命令:
#yum install jdk-8u66-linux-x64.rpm
& b.在/etc/profile中配置环境变量
export JAVA_HOME=/usr/java/jdk1.8.0_66
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$JAVA_HOME/bin:$PATH
& c.使环境变量生效
#source /etc/profile
& d.测试是否安装成功
#java -version
2.Linux上部署2个tomcat,名字为tomcat1,tomcat2
&& a.修改TOMCAT配置文件tomcat2/conf/server.xml
将以下内容
&&& &Server port="8005" shutdown="SHUTDOWN"&...
&&& &Connector port="8080" protocol="HTTP/1.1" ...
&&& &Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /&
&&& &Host name="localhost" appBase="webapps"
&&& &Server port="9005" shutdown="SHUTDOWN"&...
&&& &Connector port="9090" protocol="HTTP/1.1" ...
&&& &Connector port="9009" protocol="AJP/1.3" redirectPort="8443" /&
&&& &Host name="localhost" appBase="/usr/local/www/web"
&&& .../&
&& b.启动tomcat1和tomcat2&&&
3.Linux上安装ngnix
&& a.检查安装nginx的依赖性,nginx的模块需要第三方的支持,检查是否安装下列库:
&& zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc
&& b.安装ngnix
#tar zxvf nginx-1.0.5.tar.gz
#wget http://www.linuxidc.com/system/systemfiles/2011/08/ngx_cache_purge-1.3.tar.gz
#tar zxvf ngx_cache_purge-1.3.tar.gz
#cd nginx-1.0.5
#./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --add-module=../ngx_cache_purge-1.3
#make install
4.配置ngnix
&&& 修改/usr/local/nginx/conf/nginx.conf
&&&
&&& http {
&&& include&&&&&& mime.
&&& default_type& application/octet-
&&& #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&
&&& sendfile&&&&&&&
&&& #tcp_nopush&&&&
&&& #keepalive_timeout& 0;
&&& keepalive_timeout& 65;
&&& #gzip&
&&& upstream backserver {
server&& 127.0.0.1:8080 weight=1 max_fails=2 fail_timeout=30s;
server&& 127.0.0.1:9080 weight=1 max_fails=2 fail_timeout=30s;
&&& server {
listen&&&&& 80;
server_name&
index& index.html index.
#charset koi8-r;
#access_log& logs/host.access.log&
location / {
proxy_next_upstream http_502 http_504 error timeout invalid_
#对不同的HTTP状态码设置不同的缓存时间
proxy_pass http://backserver
expires&&&&& 1d;
#error_page& 404&&&&&&&&&&&&& /404.
# redirect server error pages to the static page /50x.html
error_page&& 500 502 503 504& /50x.
location = /50x.html {
&&& root&&
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#location ~ \.php$ {
#&&& proxy_pass&& http://127.0.0.1;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#location ~ \.php$ {
#&&& root&&&&&&&&&&
#&&& fastcgi_pass&& 127.0.0.1:9000;
#&&& fastcgi_index& index.
#&&& fastcgi_param& SCRIPT_FILENAME& /scripts$fastcgi_script_
#&&& include&&&&&&& fastcgi_
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s stop
浏览: 14461 次
来自: 郑州
劳驾问下,浏览器的任务栏是哪?
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'如何在linux服务器上部署多个tomcat服务_百度知道
如何在linux服务器上部署多个tomcat服务
我有更好的答案
到apache官网上下载了个linux下的tomcat7,然后复制到linux服务器上了,解压安装(参照的CSDN博客,如果能够启动则把一个项目的war包拷入到该tomcat的webapps下面,输入.&#47:ps -ef | grep tomcat,来查看tomcat的打开情况,删除ROOT文件夹,如果java没有安装,请自行安装,接着测试tomcat是否能够启动;shutdown.sh),再重新启动tomcat,但是有时关闭tomcat并不能完全关闭它.sh,进行开启tomcat,这样会占用端口号,所以我们使用,我用的是wcp.war包,开启时间需要看项目大小。一般情况下,是需要将tomcat关闭之后(.&#47,使用:kill - 9 编号,来关闭tomcat。然后,重启该tomcat就可以了,请自行查看下),然后进入bin目录
采纳率:88%
来自团队:
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。博客分类:
因环境需要,在linux系统需要部署两个tomcat,一个用来测试人员测试,一个用来领导演示,所以需要两个环境相互不影响。除了考虑使用不同web服务器,或者采用weblogic节点服务器外,最简单的方式就是用两个tomcat。
满足上面的需求,操作步骤如下:
1、修改端口,保证两个服务器的端口不冲突。
& 具体:将一个tomcat下的server.xml文件中的端口改掉,比如在所有的端口前面都加2,尽量是所有端口,避免进行某些操作时,端口冲突。
2、不同的tomcat启动加载的环境变量需要修改。
& 具体:将bin下的catalina.sh在最前面增加
&&&&&&& export CATALINA_BASE=/usr/local/tomcat
&&&&&&& export CATALINA_HOME=/usr/local/tomcat
&& 其中/usr/local/tomcat指的是当前tomcat的路径。
ok,如果通过以上配置,就可以满足需要。
xuejiangtao
浏览: 185800 次
来自: 西安
按照您的建议解决了非常感谢
解决了,谢谢。
真厉害,第一条就解决了,没错就是myeclipse8.5用 ...
挺好用的,但是this.stage.nativeWindow好 ...
经鉴定,有效,多谢分享!
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'

我要回帖

更多关于 tomcat服务器部署项目 的文章

 

随机推荐