Advertisement
Guest User

Untitled

a guest
May 5th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. #############################################
  2. # 這是 Nginx 服務的主要設定檔
  3. # 檔案位置預設為 /usr/local/etc/nginx/nginx.conf
  4. #############################################
  5.  
  6. # 啟用程序的 Linux 帳戶
  7. user nginx;
  8.  
  9. # 啟用的執行緒數量(建議為你的 CPU 核心數 x 2)
  10. worker_processes 2;
  11.  
  12. # Error Log 檔的位置
  13. error_log logs/error.log;
  14. error_log logs/error.log notice;
  15. error_log logs/error.log info;
  16.  
  17. pid logs/nginx.pid;
  18.  
  19. events {
  20. # 允許同一時間連線總數量
  21. worker_connections 1024;
  22. }
  23.  
  24. http {
  25. include mime.types;
  26. default_type application/octet-stream;
  27.  
  28. # 預設的 log 記錄格式
  29. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  30. '$status $body_bytes_sent "$http_referer" '
  31. '"$http_user_agent" "$http_x_forwarded_for"';
  32.  
  33. # Access log 檔的位置
  34. access_log logs/access.log main;
  35.  
  36. sendfile on;
  37. #tcp_nopush on;
  38.  
  39. #keepalive_timeout 0;
  40. keepalive_timeout 65;
  41.  
  42. # 預設不會自動啟動 gzip 壓縮
  43. #gzip on;
  44.  
  45. ** # 載入 /etc/nginx/conf.d/ 下的所有設定檔
  46. ** # 通常都是各個虛擬主機的配置
  47. ** include /etc/nginx/conf.d/*.conf;
  48. }
  49.  
  50. server {
  51. # 這個虛擬主機的 Port 和名稱
  52. listen 80;
  53. server_name localhost;
  54.  
  55. # 預設編碼,但通常不建議開啟,讓網頁中的 meta 或 header 自行定義
  56. #charset koi8-r;
  57.  
  58. # 可以額外針對這個站台修改 log 的存放位置
  59. #access_log /var/log/nginx/log/host.access.log main;
  60.  
  61. # 根目錄的設定
  62. location / {
  63. # 實際的檔案位置
  64. root /usr/local/www/nginx;
  65. # 預設首頁檔名
  66. index index.html index.htm;
  67. }
  68.  
  69. # 如果發生 404 可以指定到特定的頁面來顯示
  70. #error_page 404 /404.html;
  71.  
  72. # redirect server error pages to the static page /50x.html
  73. #
  74. error_page 500 502 503 504 /50x.html;
  75. location = /50x.html {
  76. root /usr/local/www/nginx-dist;
  77. }
  78.  
  79. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  80. #
  81. #location ~ \.php$ {
  82. # proxy_pass http://127.0.0.1;
  83. #}
  84.  
  85. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  86. #
  87. #location ~ \.php$ {
  88. # root html;
  89. # fastcgi_pass 127.0.0.1:9000;
  90. # fastcgi_index index.php;
  91. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  92. # include fastcgi_params;
  93. #}
  94.  
  95. # deny access to .htaccess files, if Apache's document root
  96. # concurs with nginx's one
  97. #
  98. #location ~ /\.ht {
  99. # deny all;
  100. #}
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement