win上配置nginx

时间:2022-04-13 08:36:22

    网上配置nginx的教程大多都是linux上的,,今天贴出来nginx在win上的配置,在此篇配置中,nginx代办代理了Tomcat以及node处事。配置如下:

    注意:按照实际经验来看,在win上改削完成nginx之后,需要将nginx的所有处事都*,然后重启,否则,只是一味的reload则处事并不会生效。

#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 51200; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 96; #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;
  #node处事端口 upstream baidu.xxx.com{ server 127.0.0.1:9919; }
  #tomcat处事端口 upstream xinlang.xxx.com{ server 127.0.0.1:8080; } server { listen 80; server_name baidu.xxx.com ; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass :9919; } } server { listen 80; server_name xianlang.xxx.com ; #charset koi8-r; #access_log logs/host.access.log main; location / { index index.html index.jsp; proxy_pass ; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 100m; } } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }