nginx.conf 的配置内容
user www www;
worker_processes auto;
error_log /dzdata/wwwlogs/error_nginx.log crit; pid /var/run/nginx.pid; worker_rlimit_nofile 65535;
events { use epoll; worker_connections 65535; multi_accept on; }
http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 1024m; client_body_buffer_size 10m; sendfile on; tcp_nopush on; keepalive_timeout 120; server_tokens off; tcp_nodelay on;
fastcgi_connect_timeout 2400; fastcgi_send_timeout 2400; fastcgi_read_timeout 2400; fastcgi_buffer_size 512k; fastcgi_buffers 4 512k; fastcgi_busy_buffers_size 1024k; fastcgi_temp_file_write_size 1024k; fastcgi_intercept_errors on;
Gzip Compression# gzip on; gzip_buffers 16 8k; gzip_comp_level 6; gzip_http_version 1.1; gzip_min_length 256; gzip_proxied any; gzip_vary on; gzip_types text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml text/javascript application/javascript application/x-javascript text/x-json application/json application/x-web-app-manifest+json text/css text/plain text/x-component font/opentype application/x-font-ttf application/vnd.ms-fontobject image/x-icon; gzip_disable "MSIE [1-6].(?!.*SV1)";
If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.# open_file_cache max=65535 inactive=20s; open_file_cache_valid 30s; open_file_cache_min_uses 2; open_file_cache_errors on;
######################## default ############################ server { listen 80; servername ; access_log /dzdata/wwwlogs/access_nginx.log combined; root /dzdata/wwwroot/default; index index.html index.htm index.php;
error_page 404 /404.html;# #error_page 502 /502.html; location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; deny all; } location ~ [^/].php(/|$) { #fastcgi_pass remote_php_ip:9000; fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location ~ ..(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; } location ~ ..(js|css)?$ { expires 7d; access_log off; } location ~ /.ht { deny all; } } ########################## vhost ############################# include vhost/*.conf; }
php-fpm.conf 配置内容
;;;;;;;;;;;;;;;;;;;;; ; FPM Configuration ; ;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;; ; Global Options ; ;;;;;;;;;;;;;;;;;;
[global] pid = run/php-fpm.pid error_log = log/php-fpm.log log_level = warning
emergency_restart_threshold = 30 emergency_restart_interval = 60s process_control_timeout = 5s daemonize = yes
;;;;;;;;;;;;;;;;;;;; ; Pool Definitions ; ;;;;;;;;;;;;;;;;;;;;
[www] listen = /dev/shm/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 listen.owner = www listen.group = www listen.mode = 0666 user = www group = www
pm = dynamic pm.max_children = 192 pm.start_servers = 144 pm.min_spare_servers = 96 pm.max_spare_servers = 192 pm.max_requests = 4096 pm.process_idle_timeout = 10s request_terminate_timeout = 900 request_slowlog_timeout = 0
pm.status_path = /php-fpm_status slowlog = log/slow.log rlimit_files = 51200 rlimit_core = 0
catch_workers_output = yes ;env[HOSTNAME] = CTS5001 env[PATH] = /usr/local/bin:/usr/bin:/bin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp#
服务器的配置 CPU: Intel Xeon E5-2650*2 硬盘: 525GB SSD 内存: 64GB DDR3 ECC 网络环境:G 口独享 CN2 线路 阿里云的 CDN#
服务器系统是 centos 6.7 PHP7.1 + Redis 4.0.1 Mysql 5.5.2
PHP 线程:12000+的时候就挂了#
服务器就 504 gateway time-out#
求大神给个解决方法! TAT 很难过。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.