nginx 配置
| worker_processes auto; |
| worker_rlimit_nofile 65536; |
| |
| |
| |
| |
| events { |
| worker_connections 20480; |
| multi_accept on; |
| use epoll; |
| } |
| |
| |
| http { |
| include mime.types; |
| default_type application/octet-stream; |
| |
| |
| |
| |
| log_format logstash '{ "@timestamp": "$time_iso8601", ' |
| '"remote_addr": "$remote_addr", ' |
| '"remote_user": "$remote_user", ' |
| '"http_host":"$http_host", ' |
| '"request_body": "$request_body", ' |
| '"status": "$status", ' |
| '"request": "$request", ' |
| '"request_method": "$request_method", ' |
| '"http_referrer": "$http_referer", ' |
| '"body_bytes_sent": $body_bytes_sent, ' |
| '"req_time": $request_time, ' |
| '"upstream_addr":"$upstream_addr", ' |
| '"upstream_req_time": "$upstream_response_time", ' |
| '"upstream_status":"$upstream_status", ' |
| '"http_x_forwarded_for": "$http_x_forwarded_for", ' |
| '"http_user_agent": "$http_user_agent" }'; |
| |
| access_log logs/access.log logstash; |
| |
| |
| |
| server_names_hash_bucket_size 128; |
| client_header_buffer_size 4k; |
| large_client_header_buffers 4 4k; |
| client_body_buffer_size 512k; |
| client_max_body_size 8m; |
| |
| sendfile on; |
| tcp_nopush on; |
| keepalive_timeout 65; |
| tcp_nodelay on; |
| charset utf-8; |
| |
| |
| open_file_cache max=65535 inactive=20s; |
| open_file_cache_valid 30s; |
| open_file_cache_min_uses 1; |
| server_tokens off ; |
| |
| proxy_connect_timeout 60; |
| proxy_read_timeout 60; |
| proxy_send_timeout 60; |
| proxy_buffer_size 128k; |
| proxy_buffers 4 128k; |
| proxy_busy_buffers_size 256k; |
| |
| fastcgi_connect_timeout 300; |
| fastcgi_send_timeout 300; |
| fastcgi_read_timeout 300; |
| fastcgi_buffer_size 128k; |
| fastcgi_buffers 8 128k; |
| fastcgi_busy_buffers_size 256k; |
| fastcgi_temp_file_write_size 256k; |
| |
| gzip on; |
| gzip_min_length 1k; |
| gzip_buffers 4 8k; |
| gzip_http_version 1.1; |
| gzip_comp_level 5; |
| gzip_types text/plain application/javascript text/javascript image/jpeg image/gif image/png text/css application/xml; |
| gzip_vary on; |
| gzip_disable "MSIE [1-6]\."; |
| add_header ServerName 'host35'; |
| |
| include /usr/local/nginx/conf/conf |
| |
| |
| |
vhost 配置
| server { |
| client_max_body_size 50m; |
| proxy_connect_timeout 600; |
| proxy_read_timeout 600; |
| proxy_send_timeout 600; |
| |
| listen 80; |
| server_name yourproject.com.cn; |
| root /data/www/yourproject/; |
| index index.php index.html index.htm; |
| charset utf-8; |
| |
| location / { |
| try_files $uri $uri/ /index.php$is_args$args; |
| } |
| |
| location ~ \.php(.*)$ { |
| fastcgi_pass unix:/dev/shm/phpfpm.sock; |
| fastcgi_index index.php; |
| fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| fastcgi_param PATH_INFO $fastcgi_path_info; |
| fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; |
| include fastcgi_params; |
| fastcgi_connect_timeout 300; |
| fastcgi_read_timeout 600; |
| fastcgi_send_timeout 600; |
| } |
| |
| location ~ /\.ht { |
| deny all; |
| } |
| |
| location /OuchnResource/{ |
| alias /jw/; |
| } |
| } |
php-fpm web 配置
| [www] |
| |
| |
| user = nobody |
| group = nobody |
| |
| listen = /dev/shm/phpfpm.sock |
| |
| listen.mode = 0666 |
| |
| |
| |
| pm = dynamic |
| |
| pm.max_children = 300 |
| |
| pm.start_servers = 20 |
| |
| pm.min_spare_servers = 5 |
| |
| pm.max_spare_servers = 35 |
| |
| |
| pm.max_requests = 0 |
| |
| |
| |
| slowlog = var/log/$pool.log.slow |
| |
| request_slowlog_timeout = 3s |
| |
| |
| request_terminate_timeout = 2m |
| |
| rlimit_files = 51200 |
【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】Flutter适配HarmonyOS 5知识地图,实战解析+高频避坑指南
【推荐】开源 Linux 服务器运维管理面板 1Panel V2 版本正式发布
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步