Articles of php fpm

连接上游时,NGINX + PHP FPM connect()失败(110:连接超时)

我们使用nginx和PHP-FPM运行一个相当大的站点,由于站点负载相当高,我们收到很多错误。 当连接到上游时,我们得到“连接()失败(110:连接超时)”…上游:“fastcgi://127.0.0.1:9000” 这是我的PHP-FPMconfiguration文件。 PHP-FPM: [www] listen = 127.0.0.1:9000 listen.allowed_clients = 127.0.0.1 user = nginx group = nginx pm = dynamic pm.max_children = 100 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 100 slowlog = /var/log/php-fpm/www-slow.log php_admin_value[error_log] = /var/log/php-fpm/www-error.log php_admin_flag[log_errors] = on 高stream量网站的服务器/儿童的推荐configuration/数量是多less? 我们尝试使用Unix套接字而不是TCP,并没有得到明显的改善。 现在的错误是:connect()unix:/var/run/php-fcgi.sock失败(11:资源暂时不可用),同时连接到上游…上游:“fastcgi:// unix:/ var / run /php-fcgi.sock:” … 谢谢, 伦纳德

php-fpm:非常高的服务器负载

由于今天我的networking服务器(VPS上的nginx + php-fpm + mysql)非常慢。 htop说: 1 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Tasks: 63 total, 13 running 2 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Load average: 11.67 10.95 6.95 3 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Uptime: 00:18:40 4 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] 5 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] 6 [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Mem[||||||||||| 137/1280MB] Swp[ 0/0MB] PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 6802 www 20 0 76232 12320 5716 R 27.0 […]

Nginx,PHP-FPM和Memcached

我在两个由Nginx提供支持的Web服务器上运行Wordpress安装程序。 我在两台服务器上都configuration了Memcached,而我正在为Memcached使用W3总caching插件: 多重Memcached服务器的推荐解决scheme是什么? 我已经在W3插件(192.168.1.1; 11211,192.168.1.2:11211)中configuration了两者,但是我不确定这是一个在caching性能方面是否好的解决scheme,将同时存储在两个服务器上? 我应该只在每个Web服务器上configurationloopack地址吗? 这实际上是如何工作的 – 在这种情况下,caching在两台服务器上都被复制? 您能否提供一些好的文章/指导如何为PHP-FPM实现chrooted环境? 推荐使用哪种PHP扩展:php-pecl-memcached或php-pecl-memcache。 W3插件实际上并不能识别php-pecl-memcached。 谢谢

我想通过apt-get在ubuntu 12.04安装php 5.3.9 – 我应该添加哪个版本库?

我想通过apt-get在Ubuntu 12.04中安装php 5.3.9。 apt-cache显示php5-fpm 只列出了5.3.10-1ubuntu3.1和5.3.10-1ubuntu3 。 5.3.10( https://bugs.php.net/bug.php?id=61045&edit=1 )中有一个重要的错误,我试图避免。 有没有一个存储库,让我安装PHP 5.3.9在Ubuntu 12.04 LTS?

Centos正在使用所有的内存caching,而不是放弃

total used free shared buffers cached Mem: 1024 1020 3 0 0 859 -/+ buffers/cache: 160 863 随着863“免费”的程序,一切都得到了内存的问题。 所有的网页都有 Warning: Unknown: Unable to allocate memory for pool. in Unknown on line 0 我怎样才能知道在地狱里吃了859mb的内存,并释放它? 我用php-fpm和mysql使用nginx。

在Centos 6中将php-fpm设置为umask的最佳位置是什么?

对于Centos 6中的以下两个php-fpm初始化configuration,您认为哪一个最适合放入,例如umask = 077? /etc/init.d/php-fpm 要么 的/ etc / SYSCONFIG / PHP-FPM 任何其他build议也是受欢迎的。 谢谢。

长时间运行的请求会阻塞所有后续请

出于某种原因,只要缓慢的请求被处理,nginx就不会接受任何新的请求。 一个简单的testing是用一个sleep()脚本并从不同的浏览器/设备调用脚本。 第一个请求被接受,第二个等待,只有第一个请求完成后才被接受。 有没有解决的办法? nginx.conf user nobody nobody; worker_processes 1; error_log /var/log/nginx-error.log notice; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; # General settings index index.html index.php; sendfile on; server_tokens off; client_max_body_size 10M; # TCP options tcp_nodelay on; tcp_nopush on; # NginxHttpGzipModule gzip on; gzip_buffers 16 8k; gzip_comp_level 5; gzip_disable "MSIE [1-6].(?!.*SV1)"; […]

GeoIP和Nginx

我有一个geoip的nginx,但它不正确。 接下来的问题是: Nginx正在从$_SERVER['REMOTE_ADDR']而不是$_SERVER['HTTP_X_HAPROXY_IP']具有真实客户端IP的地理数据。 所以,报告的地理数据属于我的服务器IP而不是客户端IP。 有没有人可能是错误来解决它? Nginx的版本和编译模块: nginx -V nginx version: nginx/1.2.3 TLS SNI support enabled configure arguments: –prefix=/etc/nginx –conf-path=/etc/nginx/nginx.conf –error-log- path=/var/log/nginx/error.log –http-client-body-temp-path=/var/lib/nginx/body –http-fastcgi-temp-path=/var/lib/nginx/fastcgi –http-log-path=/var/log/nginx/access.log –http-proxy-temp-path=/var/lib/nginx/proxy –http-scgi-temp-path=/var/lib/nginx/scgi –http-uwsgi-temp-path=/var/lib/nginx/uwsgi –lock-path=/var/lock/nginx.lock –pid-path=/var/run/nginx.pid –with-pcre-jit –with-debug –with-file-aio –with-http_addition_module –with-http_dav_module –with-http_geoip_module –with-http_gzip_static_module –with-http_image_filter_module –with-http_realip_module –with-http_secure_link_module –with-http_stub_status_module –with-http_ssl_module –with-http_sub_module –with-http_xslt_module –with-ipv6 –with-sha1=/usr/include/openssl –with-md5=/usr/include/openssl –with-mail –with-mail_ssl_module –add-module=/usr/src/nginx/source/nginx-1.2.3/debian/modules/nginx-auth-pam –add-module=/usr/src/nginx/source/nginx-1.2.3/debian/modules/nginx-echo –add-module=/usr/src/nginx/source/nginx-1.2.3/debian/modules/nginx-upstream-fair –add-module=/usr/src/nginx/source/nginx-1.2.3/debian/modules/nginx-dav-ext-module –add-module=/usr/src/nginx/source/nginx-1.2.3/debian/modules/nginx-syslog –add-module=/usr/src/nginx/source/nginx-1.2.3/debian/modules/nginx-cache-purge nginx网站conf(前端机器) […]

在NGINX + PHP-FPM中设置PHP脚本的全局处理

我必须为每个虚拟主机定义fastcgi_pass。 我如何在全球范围内定义它? server { listen 80; server_name www.domain.tld; location / { root /home/user/www.domain.tld; index index.html index.php; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/user/domain.tld$fastcgi_script_name; include fastcgi_params; } }

NGinXconfiguration为Django和WordPress的子目录

我需要在一个域的根目录build立一个Django站点,然后在一个子目录下(例如/ blog /)安装一个Wordpress。 如何configurationNGinX来做到这一点? “漂亮”的url也必须适用于WordPress。 对于Django,我正在使用已configuration好的Gunicorn。 从NGinX我会打电话给“proxy_pass”来指导。 PHP通过FPM运行。 考虑到上面的限制,我将如何configurationNGinX? 任何帮助,将不胜感激! 谢谢。 更新:我已经尝试了几件事情,目前我有一部分工作。 我已经删除了任何Djangoconfiguration。 然后我在/ blog /子目录中find了WordPress。 在那里,我有test.php,它只是调用phpinfo(),然后test.html,它显示纯净的HTML。 当调用test.php时,页面加载。 但是,当我打电话test.html,或index.php(Wordpress索引页),它给了我一个404。 我的nGinxconfiguration: server { listen 80; root /path/to/www/root; server_name domain.com; access_log /path/to/logs/access.log; error_log /path/to/logs/error.log; location / { index index.php; } location /blog { alias /path/to/www/blog; try_files $uri =404; index index.php index.html; } location ~ /blog/.+\.php$ { include […]