您现在的位置是:网站首页> 编程开发> 性能 编程开发
Linux服务端Nignx配置
2021-04-23【性能】 1589人已围观
简介修改Nginx配置文件cd /usr/local/nginx/conf/以下为nginx.conf文件#user nobody; # 运行用户 user
Linux服务端Nignx配置
最后更新:2021-04-23 13:41:00
推荐指数:
修改Nginx配置文件
cd /usr/local/nginx/conf/
以下为nginx.conf文件
#user nobody; # 运行用户 user root; #CPU数量 worker_processes 4; events { # worker_connections=worker_processes*10000,如果是https会有消耗,所以我一般都配置成 worker_processes*5000 worker_connections 20000; } http { include mime.types; default_type application/octet-stream; client_header_buffer_size 4k; fastcgi_connect_timeout 5; fastcgi_send_timeout 10; fastcgi_read_timeout 10; fastcgi_buffer_size 64k; fastcgi_buffers 32 64k; client_body_buffer_size 1024k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; fastcgi_intercept_errors on; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; #gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]\."; log_format main escape=json '$remote_addr - $remote_user [$time_iso8601] "$request" $request_body $status $body_bytes_sent "$http_referer" "$http_user_agent" "$upstream_addr" upstream_time:$upstream_response_time time:$request_time "$http_host"'; #log_format main escape=json '{"realip":"$remote_addr","@timestamp":"$time_iso8601","host":"$http_host","request":"$request","req_body":"$request_body","status":"$status","size":$body_bytes_sent,"ua":"$http_user_agent","cookie":"$http_cookie","req_time":"$request_time","uri":"$uri","referer":"$http_referer","xff":"$http_x_forwarded_for","ups_status":"$upstream_status","ups_addr":"$upstream_addr","ups_time":"$upstream_response_time"}'; client_max_body_size 100m; # 加载配置目录文件 include /usr/local/nginx/conf/web_site/*.conf; }
以下是/usr/local/nginx/conf/web_site/的.conf文件
upstream pdd.xiats.com{ # 127.0.0.1 内网IP地址 #28087 服务端口号 server 127.0.0.1:28087 weight=1 max_fails=2 fail_timeout=30s; } server { listen 80; server_name pdd.xiats.com; access_log logs/pdd_xiats_com_access.log; proxy_buffer_size 128k; proxy_buffers 32 32k; proxy_busy_buffers_size 128k; add_header X-Static transfer; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location /{ root html; index index.html; proxy_pass http://pdd.xiats.com; } }
很赞哦! (0)
下一篇:系统开发设计规范
文章评论
验证码: