初始提交
This commit is contained in:
90
py-deploy/template/nginx.yaml
Normal file
90
py-deploy/template/nginx.yaml
Normal file
@@ -0,0 +1,90 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
nginx.conf: >-
|
||||
user root;
|
||||
worker_processes 1;
|
||||
|
||||
#error_log logs/error.log;
|
||||
#error_log logs/error.log notice;
|
||||
#error_log logs/error.log info;
|
||||
|
||||
#pid logs/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 65535;
|
||||
multi_accept on;
|
||||
use epoll;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
#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 off;
|
||||
#access_log logs/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 300;
|
||||
|
||||
|
||||
ssi on;
|
||||
ssi_silent_errors on;
|
||||
ssi_types text/shtml;
|
||||
server_names_hash_bucket_size 1280;
|
||||
client_max_body_size 300M;
|
||||
client_header_buffer_size 32m;
|
||||
large_client_header_buffers 4 32m;
|
||||
|
||||
server_tokens off; #隐藏版本号
|
||||
ignore_invalid_headers on;
|
||||
recursive_error_pages on;
|
||||
server_name_in_redirect off;
|
||||
#gzip模块设置,使用 gzip 压缩可以降低网站带宽消耗,同时提升访问速度。
|
||||
gzip on; #开启gzip
|
||||
gzip_min_length 1k; #最小压缩大小
|
||||
gzip_buffers 4 16k; #压缩缓冲区
|
||||
gzip_http_version 1.1; #压缩版本
|
||||
gzip_comp_level 5; #压缩等级
|
||||
gzip_types text/javascript text/plain application/x-javascript text/css application/xml application/json image/jpeg image/png application/javascript image/gif;
|
||||
|
||||
map $http_x_forwarded_for $clientRealIp {
|
||||
"" $remote_addr;
|
||||
~^(?P<firstAddr>[0-9\.]+),?.*$ $firstAddr;
|
||||
}
|
||||
|
||||
# 将日志格式修改为如下格式:
|
||||
log_format main '{"@timestamp":"$time_iso8601",'
|
||||
'"host":"$server_addr",'
|
||||
'"service":"nginx-web",'
|
||||
'"trace":"$upstream_http_ctx_transaction_id",'
|
||||
'"log":"log",'
|
||||
'"clientip":"$remote_addr",'
|
||||
'"remote_user":"$remote_user",'
|
||||
'"request":"$request",'
|
||||
'"request_body":"$request_body",'
|
||||
'"http_user_agent":"$http_user_agent",'
|
||||
'"size":$body_bytes_sent,'
|
||||
'"responsetime":$request_time,'
|
||||
'"upstreamtime":"$upstream_response_time",'
|
||||
'"upstreamhost":"$upstream_addr",'
|
||||
'"http_host":"$host",'
|
||||
'"url":"$uri",'
|
||||
'"domain":"$host",'
|
||||
'"xff":"$http_x_forwarded_for",'
|
||||
'"referer":"$http_referer",'
|
||||
'"status":"$status"}';
|
||||
include conf.d/*.conf;
|
||||
}
|
||||
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: nginx
|
||||
namespace: {{ namespace }}
|
||||
Reference in New Issue
Block a user