Nginx基本配置文件详解与参数说明
#启动进程,通常设置成和cpu的数量相等 worker_processes 4; worker_cpu_affinity 0001 0010 0100 1000; events { #单个后台worker process进程的最大并发链接数 worker_connections 1024; multi_accept on; } http { include mime.types; default_type application/octet-stream; sendfile on; tcp_nopush on; #连接超时时间 keepalive_timeout 65; client_max_body_size 100m; #设定请求缓冲 client_header_buffer_size 10m; large_client_header_buffers 4 10m; gzip on; #301重定向跳转 server { listen 80; server_name taobye.com; return 301 https://www.taobye.com$request_uri; } #https部署方式 server { listen 80; listen 443 ssl; ssl on; server_name www.taobye.com; ssl_certificate sslkey/www.taobye.com.cer; ssl_certificate_key sslkey/www.taobye.com.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; root html; index index.jsp; proxy_pass http://127.0.0.1:8080; } } #http部署方式 server { listen 80; server_name ceshi.taobye.com; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; index index.jsp; proxy_pass http://127.0.0.1:8081; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
正在加载评论...
栏目列表
推荐阅读
- nginx配置websocket转发功能(ws转发)
- Nginx代理模式下,获取客户端ip为服务器内网ip
- nginx的location配置匹配指定多个目录
- nginx反向代理并隐藏客户端的ip(可解决weblogic受5个IP的限制)
- nginx的location配置匹配排除指定多个目录
- nginx缓存模块proxy_cache_path的用法
- nginx反向代理时丢失端口的解决办法
- 在windows服务器环境下配置nginx服务开机自启动
- nginx配置访问密码,输入用户名和密码才能访问
- Nginx开启Gzip的配置详解
- nginx过滤带有反斜杠“\”的请求
- nginx屏蔽HEAD,PUT,GET,POST,UPDATA,DELETE等操作
- nginx限制IP并发数量和时间段访问次数
- nginx防火墙中设置白名单IP(百度云加速白名单IP)
- Linux下载安装nginx的命令完整步骤图解