PageRenderTime 25ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/openshift-diy-php-master/misc/templates/nginx.conf.tpl

https://gitlab.com/power-electro/linux-server
Smarty Template | 254 lines | 191 code | 63 blank | 0 comment | 7 complexity | f5e57fc70ba1074fb766c1d760bcda66 MD5 | raw file
  1. #user nobody;
  2. worker_processes 1;
  3. #error_log logs/error.log;
  4. #error_log logs/error.log notice;
  5. #error_log logs/error.log info;
  6. error_log {{OPENSHIFT_HOMEDIR}}/app-root/logs/nginx_error.log debug;
  7. pid {{NGINX_DIR}}/logs/nginx.pid;
  8. events {
  9. worker_connections 1024;
  10. }
  11. http {
  12. include mime.types;
  13. default_type application/octet-stream;
  14. #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  15. # '$status $body_bytes_sent "$http_referer" '
  16. # '"$http_user_agent" "$http_x_forwarded_for"';
  17. #access_log logs/access.log main;
  18. #access_log $OPENSHIFT_DIY_LOG_DIR/access.log main;
  19. port_in_redirect off;
  20. sendfile on;
  21. #tcp_nopush on;
  22. #keepalive_timeout 0;
  23. keepalive_timeout 165;
  24. gzip on;
  25. upstream frontends {
  26. #server pr4ss.tk;
  27. #server 222.66.115.233:80 weight=1;
  28. server {{OPENSHIFT_INTERNAL_IP}}:8081 ;
  29. }
  30. upstream frontends2 {
  31. server google.com;
  32. #server 222.66.115.233:80 weight=1;
  33. #server {{OPENSHIFT_INTERNAL_IP}}:8081 ;
  34. }
  35. upstream index {
  36. server {{OPENSHIFT_INTERNAL_IP}}:15001 weight=1;
  37. server {{OPENSHIFT_INTERNAL_IP}}:15002 weight=2;
  38. server {{OPENSHIFT_INTERNAL_IP}}:15002 weight=3;
  39. }
  40. server {
  41. listen {{OPENSHIFT_INTERNAL_IP}}:{{OPENSHIFT_INTERNAL_PORT}};
  42. server_name {{OPENSHIFT_GEAR_DNS}} {{www.OPENSHIFT_GEAR_DNS}};
  43. root {{OPENSHIFT_REPO_DIR}};
  44. set_real_ip_from {{OPENSHIFT_INTERNAL_IP}};
  45. real_ip_header X-Forwarded-For;
  46. #charset koi8-r;
  47. #access_log logs/host.access.log main;
  48. location / {
  49. root {{OPENSHIFT_REPO_DIR}};
  50. index index.html index.htm;
  51. try_files $uri $uri/ =404;
  52. autoindex on;
  53. autoindex_exact_size off;
  54. autoindex_localtime on;
  55. #proxy_set_header Authorization base64_encoding_of_"user:password";
  56. #proxy_pass_header Server;
  57. proxy_set_header Host $http_host;
  58. proxy_redirect off;
  59. proxy_set_header X-Real-IP $remote_addr;
  60. proxy_set_header X-Scheme $scheme;
  61. }
  62. location /www {
  63. #root {{OPENSHIFT_REPO_DIR}};
  64. index index.html index.htm;
  65. autoindex on;
  66. autoindex_exact_size off;
  67. autoindex_localtime on;
  68. #proxy_set_header Authorization base64_encoding_of_"user:password";
  69. #proxy_pass_header Server;
  70. proxy_set_header Host $http_host;
  71. proxy_redirect off;
  72. proxy_set_header X-Real-IP $remote_addr;
  73. proxy_set_header X-Scheme $scheme;
  74. proxy_pass http://frontends;
  75. }
  76. location /categories {
  77. #root {{OPENSHIFT_REPO_DIR}};
  78. index index.html index.htm;
  79. autoindex on;
  80. autoindex_exact_size off;
  81. autoindex_localtime on;
  82. #proxy_set_header Authorization base64_encoding_of_"user:password";
  83. #proxy_pass_header Server;
  84. proxy_set_header Host $http_host;
  85. proxy_redirect off;
  86. proxy_set_header X-Real-IP $remote_addr;
  87. proxy_set_header X-Scheme $scheme;
  88. proxy_pass http://frontends2;
  89. }
  90. location /index {
  91. #root {{OPENSHIFT_REPO_DIR}};
  92. index index.html index.htm;
  93. autoindex on;
  94. autoindex_exact_size off;
  95. autoindex_localtime on;
  96. # an HTTP header important enough to have its own Wikipedia entry:
  97. # http://en.wikipedia.org/wiki/X-Forwarded-For
  98. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  99. proxy_set_header Host $host;
  100. proxy_set_header X-Real-IP $remote_addr;
  101. # enable this if you forward HTTPS traffic to unicorn,
  102. # this helps Rack set the proper URL scheme for doing redirects:
  103. # proxy_set_header X-Forwarded-Proto $scheme;
  104. # pass the Host: header from the client right along so redirects
  105. # can be set properly within the Rack application
  106. proxy_set_header Host $http_host;
  107. # we don't want nginx trying to do something clever with
  108. # redirects, we set the Host: header above already.
  109. proxy_redirect off;
  110. # set "proxy_buffering off" *only* for Rainbows! when doing
  111. # Comet/long-poll/streaming. It's also safe to set if you're using
  112. # only serving fast clients with Unicorn + nginx, but not slow
  113. # clients. You normally want nginx to buffer responses to slow
  114. # clients, even with Rails 3.1 streaming because otherwise a slow
  115. # client can become a bottleneck of Unicorn.
  116. #
  117. # The Rack application may also set "X-Accel-Buffering (yes|no)"
  118. # in the response headers do disable/enable buffering on a
  119. # per-response basis.
  120. # proxy_buffering off;
  121. client_max_body_size 10m;
  122. client_body_buffer_size 128k;
  123. proxy_connect_timeout 10;
  124. proxy_send_timeout 5;
  125. proxy_read_timeout 3600;
  126. proxy_buffer_size 4k;
  127. proxy_buffers 4 132k;
  128. proxy_busy_buffers_size 264k;
  129. proxy_temp_file_write_size 164k;
  130. proxy_pass http://index;
  131. #proxy_set_header Authorization base64_encoding_of_"user:password";
  132. #proxy_pass_header Server;
  133. proxy_set_header Host $http_host;
  134. }
  135. #error_page 404 /404.html;
  136. # redirect server error pages to the static page /50x.html
  137. #
  138. error_page 500 502 503 504 /50x.html;
  139. location = /50x.html {
  140. root html;
  141. }
  142. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  143. #
  144. #location ~ \.php$ {
  145. # proxy_pass http://127.0.0.1;
  146. #}
  147. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  148. #
  149. location ~ \.php$ {
  150. root html;
  151. fastcgi_pass {{OPENSHIFT_INTERNAL_IP}}:9000;
  152. fastcgi_index index.php;
  153. fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  154. include fastcgi_params;
  155. }
  156. # deny access to .htaccess files, if Apache's document root
  157. # concurs with nginx's one
  158. #
  159. #location ~ /\.ht {
  160. # deny all;
  161. #}
  162. }
  163. # another virtual host using mix of IP-, name-, and port-based configuration
  164. #
  165. #server {
  166. # listen 8000;
  167. # listen somename:8080;
  168. # server_name somename alias another.alias;
  169. # location / {
  170. # root html;
  171. # index index.html index.htm;
  172. # }
  173. #}
  174. # HTTPS server
  175. #
  176. #server {
  177. # listen 443;
  178. # server_name localhost;
  179. # ssl on;
  180. # ssl_certificate cert.pem;
  181. # ssl_certificate_key cert.key;
  182. # ssl_session_timeout 5m;
  183. # ssl_protocols SSLv2 SSLv3 TLSv1;
  184. # ssl_ciphers HIGH:!aNULL:!MD5;
  185. # ssl_prefer_server_ciphers on;
  186. # location / {
  187. # root html;
  188. # index index.html index.htm;
  189. # }
  190. #}
  191. }