widows下nignx的使用
作者:互联网
nignx在Linux环境下可以大展身手,在widows环境下也可以启动一定的效果,但是没有linux用的好。
Nginx (engine x) 是一款轻量级的Web 服务器 、反向代理服务器及电子邮件(IMAP/POP3)代理服务器。
什么是反向代理?
反向代理(Reverse Proxy)方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给internet上请求连接的客户端,此时代理服务器对外就表现为一个反向代理服务器。
具体项目的配置
1 #user nobody; 2 3 worker_processes 4; 4 5 #error_log logs/error.log; 6 7 #error_log logs/error.log notice; 8 9 #error_log logs/error.log info; 10 11 #pid logs/nginx.pid; 12 13 #worker_rlimit_nofile 65535; 14 15 events { 16 17 worker_connections 65535; 18 19 } 20 21 http { 22 23 include mime.types; 24 25 default_type application/octet-stream; 26 27 include domains/*; 28 29 map $http_upgrade $connection_upgrade { 30 default upgrade; 31 '' close; 32 } 33 34 35 sendfile on; 36 37 keepalive_timeout 60; 38 client_header_buffer_size 8k; 39 large_client_header_buffers 4 8k; 40 41 upstream tomcat { 42 43 #server 192.168.203.48:8011 max_fails=1 fail_timeout=10s; 44 server 127.0.0.1:8086 max_fails=1 fail_timeout=10s; 45 46 } 47 48 server { 49 50 #listen 8012 backlog=20480; 51 listen 8012; 52 53 server_name localhost; 54 client_body_buffer_size 1024k; 55 56 57 # set site favicon 58 location /favicon.ico { 59 root html; 60 } 61 62 location ~/(companylogo|shoppingMallImage|wwzzImage)/{ 63 64 root D:\\upload; 65 66 } 67 68 location ~ \.(js|css|png|jpg|jpeg|ico|xml|swz|svg)$ { 69 70 root ../tomcat/webapps/; 71 72 } 73 74 location / { 75 76 proxy_set_header X-Real-IP $remote_addr; 77 78 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 79 80 proxy_next_upstream error timeout invalid_header; 81 82 proxy_connect_timeout 60s; 83 84 proxy_read_timeout 60s; 85 86 proxy_send_timeout 60s; 87 88 proxy_buffer_size 4k; #设置代理服务器(nginx)保存用户头信息的缓冲区大小 89 proxy_buffers 4 32k; #proxy_buffers缓冲区,网页平均在32k以下的设置 90 proxy_busy_buffers_size 64k; #高负荷下缓冲大小(proxy_buffers*2) 91 proxy_temp_file_write_size 64k; 92 #设定缓存文件夹大小,大于这个值,将从upstream服务器传 93 94 fastcgi_connect_timeout 60s; 95 96 fastcgi_send_timeout 60s; 97 98 fastcgi_read_timeout 60s; 99 100 proxy_pass http://tomcat; 101 102 proxy_set_header Host $host; 103 104 client_max_body_size 100m; 105 106 # WebScoket Support 107 proxy_http_version 1.1; 108 109 proxy_set_header Upgrade $http_upgrade; 110 111 proxy_set_header Connection "upgrade"; 112 113 } 114 } 115 116 } 117View Code
标签:header,error,代理服务器,nignx,proxy,timeout,使用,widows,size 来源: https://www.cnblogs.com/songStar/p/11059670.html