Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #############################################
- # 這是 Nginx 服務的主要設定檔
- # 檔案位置預設為 /usr/local/etc/nginx/nginx.conf
- #############################################
- # 啟用程序的 Linux 帳戶
- user nginx;
- # 啟用的執行緒數量(建議為你的 CPU 核心數 x 2)
- worker_processes 2;
- # Error Log 檔的位置
- error_log logs/error.log;
- error_log logs/error.log notice;
- error_log logs/error.log info;
- pid logs/nginx.pid;
- events {
- # 允許同一時間連線總數量
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- # 預設的 log 記錄格式
- 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 檔的位置
- access_log logs/access.log main;
- sendfile on;
- #tcp_nopush on;
- #keepalive_timeout 0;
- keepalive_timeout 65;
- # 預設不會自動啟動 gzip 壓縮
- #gzip on;
- ** # 載入 /etc/nginx/conf.d/ 下的所有設定檔
- ** # 通常都是各個虛擬主機的配置
- ** include /etc/nginx/conf.d/*.conf;
- }
- server {
- # 這個虛擬主機的 Port 和名稱
- listen 80;
- server_name localhost;
- # 預設編碼,但通常不建議開啟,讓網頁中的 meta 或 header 自行定義
- #charset koi8-r;
- # 可以額外針對這個站台修改 log 的存放位置
- #access_log /var/log/nginx/log/host.access.log main;
- # 根目錄的設定
- location / {
- # 實際的檔案位置
- root /usr/local/www/nginx;
- # 預設首頁檔名
- index index.html index.htm;
- }
- # 如果發生 404 可以指定到特定的頁面來顯示
- #error_page 404 /404.html;
- # redirect server error pages to the static page /50x.html
- #
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/local/www/nginx-dist;
- }
- # proxy the PHP scripts to Apache listening on 127.0.0.1:80
- #
- #location ~ \.php$ {
- # proxy_pass http://127.0.0.1;
- #}
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- #location ~ \.php$ {
- # root html;
- # fastcgi_pass 127.0.0.1:9000;
- # fastcgi_index index.php;
- # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
- # include fastcgi_params;
- #}
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- #
- #location ~ /\.ht {
- # deny all;
- #}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement