云服务器 nginx + tomcat 部署集群 配置
2023-09-27 14:27:23 时间
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 { worker_connections 1024; } 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; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upstream tomcats { server 10.154.49.196:8080; } upstream tomcats-quartz { server 10.154.49.196:8081; } server { listen 80; server_name www.itzixi.com; #itzixi.com; access_log /home/wwwlogs/www.itzixi.com_nginx.log combined; root /home/wwwroot/www.itzixi.com; index index.html index.htm index.jsp index.action index; #rewrite ^(.*)$ https://$host$1 permanent; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; } location ~ .*\.(js|css)?$ { expires 7d; access_log off; } location ~ { #/ { proxy_pass http://tomcats; # open tomcat servera include proxy.conf; } } # ssl(https) config # server { # listen 443; # server_name www.itzixi.com; # itzixi.com; # access_log /home/wwwlogs/www.itzixi.com_nginx.log combined; # root /home/wwwroot/www.itzixi.com; # index index.html index.htm index.jsp index.action index; # # location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { # expires 30d; # access_log off; # } # # location ~ .*\.(js|css)?$ { # expires 7d; # access_log off; # } # # ssl on; # ssl_certificate 1_www.itzixi.com_bundle.crt; # ssl_certificate_key 2_www.itzixi.com.key; # ssl_session_timeout 5m; # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; # ssl_prefer_server_ciphers on; # location ~ { #/ { # proxy_pass http://tomcats; # open tomcat server # include proxy.conf; # } # # } # image server server { listen 88; server_name localhost; #server_name www.itzixi.com itzixi.com; location /group1/M00 { ngx_fastdfs_module; } } }
proxy.conf
proxy_connect_timeout 300s; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 32k; proxy_buffers 4 64k; proxy_busy_buffers_size 128k; proxy_redirect off; proxy_hide_header Vary; proxy_set_header Accept-Encoding ''; proxy_set_header Referer $http_referer; proxy_set_header Cookie $http_cookie; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
server.xml,注释掉原来的host,加入下面这行
<Host name="localhost" appBase="" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="/home/wwwroot/www.itzixi.com" reloadable="false" crossContext="true"/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="www.itzixi.com_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host>
项目从war包解压后放入此目录:
/home/wwwroot/www.itzixi.com
相关文章
- Centos6.5生成环境配置--nginx1.9 + PHP+可多个tomcat(多个端口)+多域名+java web 负载均衡
- Tomcat 7.0配置SSL的问题及解决办法
- 3、CentOS 6.5系统安装配置Tomcat 8详细过程
- [ nginx ] 代理后端tomcat 无法显示图片报错:ERR_CONTENT_LENGTH_MISMATCH
- intellij IDEA配置tomcat
- CentOS-7.0.中安装与配置Tomcat-7的方法
- Tomcat系列之服务器的安装与配置以及各组件详解
- Tomcat Manager用户配置详解
- Tomcat服务器安装、配置、测试
- tomcat 配置 https 证书
- CentOS-7.0.中安装与配置Tomcat-7的方法
- SpringMVC入门到实战------七、SpringMVC创建JSP页面的详细过程+配置模板+实现页面跳转+配置Tomcat。JSP和HTML配置模板的差异对比(二)
- 在Mac系统上安装Tomcat
- tomcat虚拟路径的几种配置方法
- 腾讯云服务器 - 配置JDK环境以及Tomcat+nginx服务器
- Java web:TOMCAT 环境配置
- 杜绝假死,Tomcat容器做到自我保护,设置最大连接数(服务限流:tomcat请求数限制)