- #vim /usr/local/nginx/conf/nginx.conf
- log_format access ‘$remote_addr – $remote_user [$time_local] “$request” ‘‘$status $body_bytes_sent “$http_referer” ‘‘”$http_user_agent” $http_x_forwarded_for’;
- include /usr/local/nginx/conf/vhost/*.conf;
- #vim /usr/local/nginx/conf/vhost/web.conf
- server
- {
- listen 80 default;
- server_name www.msits.com;
- index index.html index.htm index.php;
- root /data/httpd/msits.com;
- location ~ .*\.php?$
- include fastcgi.conf;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- }
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- expires 30d;
- location ~ .*\.(js|css)?$
- expires 1h;
- access_log /usr/local/nginx/logs/access.log access;
- $remote_addr 與$http_x_forwarded_for 用以記錄用戶端的ip位址;
- $remote_user :用來記錄用戶端使用者名稱;
- $time_local : 用來記錄通路時間與時區;
- $request : 用來記錄請求的url與http協定;
- $status : 用來記錄請求狀态;成功是200,
- $body_bytes_s ent :記錄發送給用戶端檔案主體内容大小;
- $http_referer :用來記錄從那個頁面連結通路過來的;
- $http_user_agent :記錄用戶端浏覽器的相關資訊;