nginx.conf 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. worker_processes 1;
  2. #error_log logs/error.log;
  3. #error_log logs/error.log notice;
  4. error_log logs/error.log info;
  5. pid logs/nginx.pid;
  6. events {
  7. worker_connections 2048;
  8. multi_accept on;
  9. }
  10. http {
  11. include mime.types;
  12. default_type application/octet-stream;
  13. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  14. '$status $body_bytes_sent "$http_referer" '
  15. '"$http_user_agent" "$http_x_forwarded_for"';
  16. access_log logs/access.log main;
  17. sendfile on;
  18. tcp_nopush on;
  19. keepalive_timeout 20s;
  20. server_names_hash_bucket_size 64;
  21. gzip on; #on or off
  22. gzip_min_length 1k; #min compress file length
  23. gzip_buffers 4 16k;
  24. gzip_http_version 1.1; #compress protocol version
  25. gzip_comp_level 2; #compress level
  26. gzip_types text/plain application/x-javascript text/css application/xml; #default text/html
  27. gzip_vary on;
  28. #upstream 192.168.1.105 {
  29. # server 192.168.1.105:8090 max_fails=2 fail_timeout=60s weight=2;
  30. # server 192.168.1.105:8080 max_fails=2 fail_timeout=60s weight=1;
  31. #}
  32. server {
  33. listen 80;
  34. server_name hotelping.cn www.hotelping.cn localhost m.hotelping.cn www.pogoy.cn pogoy.cn www.knowledgesocial.com.cn knowledgesocial.com.cn www.nowledgedata.com.cn nowledgedata.com.cn;
  35. charset UTF-8;
  36. access_log logs/host.access.log main;
  37. include proxy.conf;
  38. location / {
  39. if ( $host ~ "(.*)nowledgedata.com.cn" ) {
  40. rewrite ^(.*)$ /home/$1 last;
  41. }
  42. if ( $host ~ "(.*)pogoy.cn" ) {
  43. rewrite ^(.*)$ /pogoy/$1 last;
  44. }
  45. if ( $host ~ "(.*)knowledgesocial.com.cn" ) {
  46. rewrite ^(.*)$ /sgtz/$1 last;
  47. }
  48. index index.jsp index.html;
  49. proxy_pass http://127.0.0.1:8080;
  50. proxy_set_header Host $host:80;
  51. proxy_set_header X-Real-IP $remote_addr;
  52. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  53. proxy_set_header Via "nginx";
  54. }
  55. location /home {
  56. index index.html index.htm;
  57. proxy_pass http://127.0.0.1:8090;
  58. proxy_set_header Host $host:80;
  59. proxy_set_header X-Real-IP $remote_addr;
  60. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  61. proxy_set_header Via "nginx";
  62. }
  63. location ~ /pogoy {
  64. index main.jsp index.html index.htm;
  65. proxy_pass http://127.0.0.1:8090;
  66. proxy_set_header Host $host:80;
  67. proxy_set_header X-Real-IP $remote_addr;
  68. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  69. proxy_set_header Via "nginx";
  70. }
  71. location ~ /ndf {
  72. index main.jsp index.jsp index.htm;
  73. proxy_pass http://127.0.0.1:8983;
  74. proxy_set_header Host $host:80;
  75. proxy_set_header X-Real-IP $remote_addr;
  76. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  77. proxy_set_header Via "nginx";
  78. }
  79. location ~ /sgtz {
  80. index index.jsp index.html index.htm;
  81. proxy_pass http://127.0.0.1:8090;
  82. proxy_set_header Host $host:80;
  83. proxy_set_header X-Real-IP $remote_addr;
  84. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  85. proxy_set_header Via "nginx";
  86. }
  87. error_page 404 /404.html;
  88. # redirect server error pages to the static page /50x.html
  89. #
  90. error_page 500 502 503 504 /50x.html;
  91. location = /50x.html {
  92. root html;
  93. }
  94. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  95. #
  96. #location ~ \.php$ {
  97. # root html;
  98. # fastcgi_pass 127.0.0.1:9000;
  99. # fastcgi_index index.php;
  100. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  101. # include fastcgi_params;
  102. #}
  103. # deny access to .htaccess files, if Apache's document root
  104. # concurs with nginx's one
  105. #
  106. #location ~ /\.ht {
  107. # deny all;
  108. #}
  109. }
  110. server {
  111. listen 80;
  112. server_name ques.hotelping.cn;
  113. charset UTF-8;
  114. include proxy.conf;
  115. location / {
  116. index index.jsp index.html index.htm;
  117. proxy_pass http://127.0.0.1:8080/ques/;
  118. proxy_set_header Host $host:80;
  119. proxy_set_header X-Real-IP $remote_addr;
  120. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  121. proxy_set_header Via "nginx";
  122. }
  123. }
  124. server {
  125. listen 80;
  126. server_name apps.hotelping.cn;
  127. charset UTF-8;
  128. include proxy.conf;
  129. location / {
  130. index index.jsp index.html index.htm;
  131. proxy_pass http://127.0.0.1:8080/apps/;
  132. proxy_set_header Host $host:80;
  133. proxy_set_header X-Real-IP $remote_addr;
  134. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  135. proxy_set_header Via "nginx";
  136. }
  137. }
  138. # another virtual host using mix of IP-, name-, and port-based configuration
  139. #
  140. #server {
  141. # listen 8000;
  142. # listen somename:8080;
  143. # server_name somename alias another.alias;
  144. # location / {
  145. # root html;
  146. # index index.html index.htm;
  147. # }
  148. #}
  149. # HTTPS server
  150. #
  151. #server {
  152. # listen 443;
  153. # server_name localhost;
  154. # ssl on;
  155. # ssl_certificate cert.pem;
  156. # ssl_certificate_key cert.key;
  157. # ssl_session_timeout 5m;
  158. # ssl_protocols SSLv2 SSLv3 TLSv1;
  159. # ssl_ciphers HIGH:!aNULL:!MD5;
  160. # ssl_prefer_server_ciphers on;
  161. # location / {
  162. # root html;
  163. # index index.html index.htm;
  164. # }
  165. #}
  166. }