> `$args` #這個變量等于請求行中的參數。
> `$content_length` #請求頭中的Content-length字段。
> `$content_type` #請求頭中的Content-Type字段。
> `$document_root` #當前請求在root指令中指定的值。
> `$host` #請求主機頭字段,否則為服務器名稱。
> `$http_user_agent` #客戶端agent信息
> `$http_cookie` #客戶端cookie信息
> `$limit_rate` #這個變量可以限制連接速率。
> `$request_body_file` #客戶端請求主體信息的臨時文件名。
> `$request_method` #客戶端請求的動作,通常為GET或POST。
> `$remote_addr` #客戶端的IP地址。
> `$remote_port` #客戶端的端口。
> `$remote_user` #已經經過Auth Basic Module驗證的用戶名。
> `$request_filename` #當前請求的文件路徑,由root或alias指令與URI請求生成。
> `$query_string` #與$args相同。
> `$scheme` #HTTP方法(如http,https)。
> `$server_protocol` #請求使用的協議,通常是HTTP/1.0或HTTP/1.1。
> `$server_addr` #服務器地址,在完成一次系統調用后可以確定這個值。
> `$server_name` #服務器名稱。
> `$server_port` #請求到達服務器的端口號。
> `$request_uri` #包含請求參數的原始URI,不包含主機名,如:”/foo/bar.php?arg=baz”。
> `$uri` #不帶請求參數的當前URI,$uri不包含主機名,如”/foo/bar.html”。
> `$document_uri` #與$uri相同。
...
http {
\# 自定義日志輸出格式
? ? log\_format aka\_logs
'{"@timestamp":"$time\_iso8601",'
'"host":"$hostname",'
'"server\_ip":"$server\_addr",'
'"client\_ip":"$remote\_addr",'
'"xff":"$http\_x\_forwarded\_for",'
'"domain":"$host",'
'"url":"$uri",'
'"referer":"$http\_referer",'
'"args":"$args",'
'"upstreamtime":"$upstream\_response\_time",'
'"responsetime":"$request\_time",'
'"request\_method":"$request\_method",'
'"status":"$status",'
'"size":"$body\_bytes\_sent",'
'"request\_body":"$request\_body",'
'"request\_length":"$request\_length",'
'"protocol":"$server\_protocol",'
'"upstreamhost":"$upstream\_addr",'
'"file\_dir":"$request\_filename",'
'"http\_user\_agent":"$http\_user\_agent"'
'}';
\# 指定日志輸出位置 /var/log/nginx/access.log
? ? access\_log ?/var/log/nginx/access.log ?aka\_logs;
? ? ...
}
log\_format aka\_logs
'{"@timestamp":"$time\_iso8601",'
'"host":"$hostname",'
'"server\_ip":"$server\_addr",'
'"client\_ip":"$remote\_addr",'
'"a":"$a",'
'"r":"$r",'
'}';
\# 指定日志輸出位置 /var/log/nginx/access.log
access\_log ?/www/wwwlogs/aizhuangdian.com.erroraa.log aka\_logs;
set $a 0;
if ($host = test.aizhuangdian.com){
set $a "${a}1";
}
set $r "${document\_root}/m${uri}";
if (-f $r){
set $a "${a}2";
}
if ($a = "012") {
? ? rewrite ?^(.\*)$ ?/m$1 last; break;
}
- 簡介
- PHP
- 字符串函數
- 數組函數
- 正則
- 加密函數
- 面向對象
- 關鍵字
- 設計模式
- 魔術方法
- 機制擴展
- 會話機制
- PHP框架
- laravel
- 問題
- swoole
- easyswoole
- workerman
- 數據庫
- Sphinx
- MongoDB
- MemCache
- Redis
- 基礎操作
- 數據類型
- 持久化
- 分布式鎖
- 內存模型
- redis高級特性
- MySql
- 基礎操作
- 數據類型
- 數據表引擎
- 鎖機制
- 事務處理
- 存儲過程
- 觸發器
- 索引
- 關聯查詢
- 分析SQL語句-優化查詢
- 分區分表
- 主從復制
- MySql安全性
- 網絡協議
- HTTP
- header詳解
- 狀態碼
- nginx-配置
- 邏輯算法
- 時間和空間復雜度
- 常見算法
- 數據結構
- 核心
- 進程、線程、協程
- 存儲容量-計量單位
- 開發軟件及配置
- 版本控制器
- Git
- Fidder
- Fidder-Android7
- 自動化部署
- Jenkins
- supervisor
- Elasticsearch
- LogStash
- RabbitMQ
- AB測試
- JAVA-JDK
- FileBeat
- PhpStorm
- Composer
- Linux
- API安全
- 高并發及大流量相關概念
- 網站優化
- WEB
- Electron