当前位置:Gxlcms > PHP教程 > Nginxconf配置文件标准配置。

Nginxconf配置文件标准配置。

时间:2021-07-01 10:21:17 帮助过:17人阅读

  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 /usr/local/var/log/nginx/error.log warn;
  7. #pid logs/nginx.pid;
  8. #pid /usr/local/var/run/nginx.pid;
  9. events {
  10. worker_connections 256;
  11. }
  12. http {
  13. include mime.types;
  14. default_type application/octet-stream;
  15. #kaiqi-default
  16. #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  17. # '$status $body_bytes_sent "$http_referer" '
  18. # '"$http_user_agent" "$http_x_forwarded_for"';
  19. #access_log logs/access.log main;
  20. #access_log /usr/local/var/log/nginx/access.log main;
  21. sendfile on;
  22. #tcp_nopush on;
  23. #keepalive_timeout 0;
  24. keepalive_timeout 65;
  25. #gzip on;
  26. client_max_body_size 10m;
  27. server {
  28. listen 8080;
  29. server_name localhost;
  30. #charset koi8-r;
  31. #access_log logs/host.access.log main;
  32. location / {
  33. root /usr/local/var/www;
  34. index index.html index.htm;
  35. }
  36. #error_page 404 /404.html;
  37. # redirect server error pages to the static page /50x.html
  38. #
  39. error_page 500 502 503 504 /50x.html;
  40. location = /50x.html {
  41. root html;
  42. }
  43. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  44. #
  45. #location ~ \.php$ {
  46. # proxy_pass http://127.0.0.1;
  47. #}
  48. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  49. #
  50. location ~ \.php$ {
  51. root /usr/local/var/www;
  52. fastcgi_pass 127.0.0.1:9000;
  53. fastcgi_index index.php;
  54. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  55. include fastcgi_params;
  56. }
  57. # deny access to .htaccess files, if Apache's document root
  58. # concurs with nginx's one
  59. #
  60. #location ~ /\.ht {
  61. # deny all;
  62. #}
  63. }
  64. # another virtual host using mix of IP-, name-, and port-based configuration
  65. #
  66. #server {
  67. # listen 8000;
  68. # listen somename:8080;
  69. # server_name somename alias another.alias;
  70. # location / {
  71. # root html;
  72. # index index.html index.htm;
  73. # }
  74. #}
  75. # HTTPS server
  76. #
  77. #server {
  78. # listen 443 ssl;
  79. # server_name localhost;
  80. # ssl_certificate cert.pem;
  81. # ssl_certificate_key cert.key;
  82. # ssl_session_cache shared:SSL:1m;
  83. # ssl_session_timeout 5m;
  84. # ssl_ciphers HIGH:!aNULL:!MD5;
  85. # ssl_prefer_server_ciphers on;
  86. # location / {
  87. # root html;
  88. # index index.html index.htm;
  89. # }
  90. #}
  91. server {
  92. listen 8081;
  93. server_name develop.com;
  94. #access_log logs/host.access.log main;
  95. location / {
  96. root /usr/local/var/www/develop;
  97. index index.php index.html index.htm;
  98. }
  99. #error_page 404 /404.html;
  100. # redirect server error pages to the static page /50x.html
  101. #
  102. #error_page 500 502 503 504 /50x.html;
  103. #location = /50x.html {
  104. # root html;
  105. #}
  106. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  107. #
  108. #location ~ \.php$ {
  109. # proxy_pass http://127.0.0.1;
  110. #}
  111. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  112. #
  113. location ~ \.php$ {
  114. root /usr/local/var/www/develop;
  115. fastcgi_pass 127.0.0.1:9000;
  116. index index.php
  117. fastcgi_index index.php;
  118. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  119. include fastcgi_params;
  120. }
  121. # deny access to .htaccess files, if Apache's document root
  122. # concurs with nginx's one
  123. #
  124. #location ~ /\.ht {
  125. # deny all;
  126. #}
  127. }
  128. server {
  129. listen 8082;
  130. server_name phpmyadmin.com;
  131. #access_log logs/host.access.log main;
  132. location / {
  133. root /usr/local/var/www/phpmyadmin;
  134. index index.php index.html index.htm;
  135. }
  136. #error_page 404 /404.html;
  137. # redirect server error pages to the static page /50x.html
  138. #
  139. #error_page 500 502 503 504 /50x.html;
  140. #location = /50x.html {
  141. # root html;
  142. #}
  143. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  144. #
  145. #location ~ \.php$ {
  146. # proxy_pass http://127.0.0.1;
  147. #}
  148. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  149. #
  150. location ~ \.php$ {
  151. root /usr/local/var/www/phpmyadmin;
  152. fastcgi_pass 127.0.0.1:9000;
  153. index index.php
  154. fastcgi_index index.php;
  155. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  156. include fastcgi_params;
  157. }
  158. # deny access to .htaccess files, if Apache's document root
  159. # concurs with nginx's one
  160. #
  161. #location ~ /\.ht {
  162. # deny all;
  163. #}
  164. }
  165. include servers/*;
  166. #include /usr/local/etc/nginx/conf.d/*.conf;
  167. }

以上就介绍了 Nginxconf 配置文件标准配置。,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

人气教程排行