配置Nginx服务器
@author estone
1.Nginx配置文件内容
server ip : your.own.server.ip
config file path: /usr/local/webserver/nginx/conf/nginx.conf
--------------[S]---nginx config file content---[S]---------------
user www www;
worker_processes 8;
pid /usr/local/webserver/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;
error_log logs/error.log;
events {
use epoll;
worker_connections 51200;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
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 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
# tomcat banlcance server list
upstream your.website.name {
server your.tomcat.server.ip1:8080;
server your.tomcat.server.ip2:8080;
}
# virtual host configuration
server {
listen 80;
server_name your.website.name ;
charset utf-8;
# redirect all client request to tomcat cluster
location / {
root /var/www/;
index index.html index.htm index.jsp;
proxy_redirect off;
# keep all user data
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
proxy_pass http://your.website.name;
}
location ~ ^/(WEB-INF)/ {
deny all;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
--------------[E]---nginx config file content---[E]---------------
2.检查配置文件内容是否正确
# /usr/local/webserver/nginx/sbin/nginx -t
若输出信息为:
the configuration file /usr/local/webserver/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/webserver/nginx/conf/nginx.conf test is successful
则说明nginx.conf配置文件内容正确
3.添加Nginx的启动和关闭脚本
server ip : you.own.server.ip
nginx startup script : /usr/local/webserver/nginx/sbin/nginx.sh
4.修改启动脚本的权限
chmod u+x /usr/local/webserver/nginx/sbin/nginx.sh
5.使用脚本启动Nignx服务器
/usr/local/webserver/nginx/sbin/nginx.sh start
6.Nignx启动脚本使用说明
启动:/usr/local/webserver/nginx/sbin/nginx.sh start
关闭:/usr/local/webserver/nginx/sbin/nginx.sh stop
重启:/usr/local/webserver/nginx/sbin/nginx.sh restart
其中重启选项只能在Nginx已经启动的状态下使用,否则会出现错误。
分享到:
相关推荐
一份不错的Nginx Tomcat集群部署说明
Nginx+tomcat配置集群负载均衡实现动静分离实例
Nginx+Redis+Tomcat 集群部署文档以及所需jar包和Nginx+Redis+Tomcat安装包
ApacheTomcat集群部署配置整合方案
nginx+tomcat集群配置文件
这篇文档是介绍Nginx tomcat mybatis 集群部署的文档,对tomcat集群干兴趣的同学可以研究一下
windowXP下搭建nginx-1.7.10和apache-tomcat-8.0.18的集群 已经配置好,下载后直接启动三个tomcat和nginx,然后访问http://localhost/即可。
nginx,tomcat集群,session共享,基于memcache 包含nginx配置,tomcat配置,以及tomcat所需要的jar 不包含nginx,tomcat,jdk,memcache的安装
关于nginx和tomcat在window下的下载安装和使用等。仅供参考。
基于ssm+shiro+redis+nginx tomcat服务器集群管理项目 基于ssm+shiro+redis+nginx tomcat服务器集群管理项目 基于ssm+shiro+redis+nginx tomcat服务器集群管理项目 基于ssm+shiro+redis+nginx tomcat服务器集群管理...
nginx + tomcat 集群配置 负载 nginx 下载地址: http://nginx.org/en/download.html 联合tomcat 实现集群 windows: Nginx.conf 配置 //见文件夹下面的nginx.conf 更改tomcat的配置: 第一处端口...
nginx+tomcat集群部署与负载均衡。。。。。。。。。。。。。。。。。。。。。。。。。
nginx 配置tomcat8集群
nginx+Tomcat集群简单配置及相关文档
linux下nginx-tomcat集群及session共享,亲测成功,下载的文件包含了所有需要的jar包及nginx,memcached安装,配置,由于试了很多种方法,下了很多包,有些也需要积分,所以这里下载要些积分留着用,不好意思了,...
Linux Centos7中搭建Nginx负载均衡,里面包含了详细文档(ps:有详细的操作步骤哟),还有相关的安装包以及测试包
Nginx Tomcat 集群的Session 复制,解决了,集群情况下的session复制问题。
nginx+tomcat+redis集群部署环境,包括nginx tomcat redis及集群部署所需jar包,jedis-2.6.1.jar,commons-pool2-2.2.jar,tomcat-redis-session-manager1.2.jar 具体步骤可以参见我的博文
Docker-Compose部署nginx代理Tomcat集群,实现负载均衡!