nginx配置环境
server {
listen 80;
server_name “域名”;
root 文件地址;
index index.php;
charset utf-8;
sendfile off;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 2;
gzip_types application/json;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
client_max_body_size 20m;
set $trace_id $http_x_trace_id; #日志加上trace_id,前端传一个request_id
if ($trace_id = '') {
set $trace_id $request_id;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
access_log /data/wwwlogs/access_crm-api.xiaotangketang.com.log json_format;
error_log /data/wwwlogs/error_crm-api.xiaotangketang.com.log;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param APP_ENV test; # 读取的配置文件
fastcgi_param HTTP_X_TRACE_ID $trace_id;
}
}