Nginx 管理程序
2016-03-11 00:00
567 查看
Windows下 部署Nginx tomcat 设置个人记录
cls @ECHO OFF SET NGINX_PATH=D: SET NGINX_DIR=D:\nginx\ color 0a TITLE Nginx管理程序 GOTO MENU :MENU CLS ECHO. ECHO. * * * * Nginx Management * * * * ECHO. * * ECHO. * 1 启动Nginx * ECHO. * * ECHO. * 2 关闭Nginx * ECHO. * * ECHO. * 3 重启Nginx * ECHO. * * ECHO. * 4 退 出 * ECHO. * * ECHO. * * * * * * * * * * * * * * * * * * * * * * * * ECHO. ECHO.请输入选择项目的序号: set /p ID= IF "%id%"=="1" GOTO cmd1 IF "%id%"=="2" GOTO cmd2 IF "%id%"=="3" GOTO cmd3 IF "%id%"=="4" EXIT PAUSE :cmd1 ECHO. ECHO.启动Nginx...... IF NOT EXIST %NGINX_DIR%nginx.exe ECHO %NGINX_DIR%nginx.exe不存在 %NGINX_PATH% cd %NGINX_DIR% IF EXIST %NGINX_DIR% start %NGINX_DIR%nginx.exe ECHO.OK PAUSE GOTO MENU :cmd2 ECHO. ECHO.关闭Nginx...... taskkill /F /IM nginx.exe > nul ECHO.OK PAUSE GOTO MENU :cmd3 ECHO. ECHO.关闭Nginx...... taskkill /F /IM nginx.exe > nul ECHO.OK GOTO cmd1 GOTO MENUgzip.conf
gzip on; gzip_min_length 1024; gzip_buffers 4 8k; gzip_comp_level 9; gzip_proxied any; gzip_types application/xml application/javascript application/x-javascript application/atom+xml application/rss+xml; gzip_types text/css text/html text/javascript text/js text/plain text/xml;proxy.conf
proxy_redirect off; 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 10m; client_body_buffer_size 128k; proxy_connect_timeout 300; proxy_send_timeout 300; proxy_read_timeout 300; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k;nginx.conf
#Nginx所用用户和组,window下不指定 #user niumd niumd; #工作的子进程数量(通常等于CPU数量或者2倍于CPU) worker_processes 2; #错误日志存放路径 #error_log logs/error.log; #error_log logs/error.log notice; error_log logs/error.log info; #指定pid存放文件 pid logs/nginx.pid; events { #使用网络IO模型linux建议epoll,FreeBSD建议采用kqueue,window下不指定。 #use epoll; #允许最大连接数 worker_connections 2048; } 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 off; access_log logs/access.log; client_header_timeout 3m; client_body_timeout 3m; fastcgi_buffers 8 128k; send_timeout 3m; client_header_buffer_size 1k; large_client_header_buffers 4 4k; sendfile on; tcp_nopush on; tcp_nodelay on; #keepalive_timeout 75 20; include gzip.conf; include proxy.conf; upstream localhost { #根据ip计算将请求分配各那个后端tomcat,许多人误认为可以解决session问题,其实并不能。 #同一机器在多网情况下,路由切换,ip可能不同 #ip_hash; #weigth参数表示权值,权值越高被分配到的几率越大 server 127.0.0.1:8080 weight=10; } server { listen 80; server_name localhost; location / { root D:/tomcat1/webapps/ROOT/; index index.html index.htm index.jsp; } location ~ .*\.(html|js|css|png|gif|jpeg|jpg|apk|pda|swf|bmp)$ { root E:/W/workspace/1.0/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/com.cckj.smgr.server; } location ~ \.(jsp|action|do|m)$ { proxy_connect_timeout 3; proxy_send_timeout 30; proxy_read_timeout 30; proxy_pass http://localhost; } location ~ ^/(WEB-INF)/ { #这个很重要,不然用户就可以访问了 deny all; } } }
相关文章推荐
- nginx代理指定目录
- 访问Nginx发生SSL connection error的一种情况
- Nginx+Naxsi部署专业级Web应用防火墙
- CentOS 6.2实战部署Nginx+MySQL+PHP
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- nginx中http核心模块的配置指令4
- nginx中http的fastcgi模块的配置指令1
- Nginx 学习笔记(一)
- 网站502与504错误分析
- 用zabbix监控nginx_status状态
- 艰难完成 nginx + puma 部署 rails 4的详细记录
- 把Lua编译进nginx步骤方法
- web 应用中常用的各种 cache详解
- Linux系统上配置Nginx+Ruby on Rails+MySQL超攻略
- window+nginx+php环境配置 附配置搭配说明
- 解析CI即CodeIgniter框架在Nginx下的重写规则
- 将PHP从5.3.28升级到5.3.29时Nginx出现502错误
- 基于Nginx0.8.54+PHP5.3.4+MySQL5.5.8的全新LNMP稳定版架构搭建的VPS