Articles of php fpm

nginx,fpm – 错误的网关错误在PHP

我在这里被困在一个坏的网关问题和PHP 我在Debian Wheezy上使用Nginx 1.6和FPM。 它是一个干净和新的安装。 但每次如果我运行一个PHP文件,将导致一个错误的网关错误。 所以我几乎读了所有我发现的问题,但没有任何帮助。 从设置我使用多个虚拟主机(通过Ipsconfigpipe理)。 每个虚拟主机configuration文件都在Unix套接字上运行。 例: listen = /var/lib/php5-fpm/web4.sock listen.owner = web4 listen.group = client1 listen.mode = 0660 user = web4 group = client1 pm = dynamic pm.max_children = 10 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 5 pm.max_requests = 0 chdir = / 我的池ww conf看起来像http://pastebin.com/raw.php?i=4BU4sTEs 我的FPMconfigurationhttp://pastebin.com/gDcgV0aZ 从这边所有的套接字都在特定的文件夹中,但是只导致坏的网关消息。 日志文件在debugging模式下也是空的。 令人不安的是,如果我改变了nginx的虚拟主机 […]

位置指令在使用php-fpm时不工作(通过mod_fastcgi)

我已经configuration了一个虚拟主机,应该完全限制一个SSL客户端证书,除了一个位置(/ Public)。 我的虚拟主机中的configuration: <Location ~ ^/(?!Public)> SSLRequireSSL SSLVerifyClient require SSLVerifyDepth 10 SSLOptions +StdEnvVars -ExportCertData </Location> 我已经使用mod_fastcgi完成了一些testing: 请求https://myserver.mycompany.com/MyWorkspace ,服务器正在请求SSL客户端证书 – >按devise工作。 请求https://myserver.mycompany.com/Public/index.html ,服务器没有请求SSL客户端证书 – >按devise工作。 请求https://myserver.mycompany.com/Public/index.php ,服务器正在请求SSL客户端证书 – > Works不按照devise。 当我使用mod_php进行最后的testing时,服务器没有请求SSL客户端证书,这是正确的。 这是正常的行为,还是我错误configuration了一些东西? 我的mod_fastcgiconfiguration如下: LoadModule fastcgi_module modules/mod_fastcgi.so <IfModule mod_fastcgi.c> DirectoryIndex index.php index.html index.shtml index.cgi AddHandler php5-fcgi .php Action php5-fcgi /php5-fcgi Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /dev/shm/php5-fpm.sock […]

Apache + Event_MPM + FastCgiExternalServer + php5-fpm:php-fpm挂起emergency_restart_threshold不会重置

对不起,如果这似乎漫步。 我一直试图解决/解决这个过去20个小时的直接,而不得不保姆服务器,并重新启动php5-fpm每次下降。 我想象一个插件(高stream量的WordPress站点)或挂在那个线程,可能会导致绑定其他线程的依赖锁的一个基本问题。 我的直接担忧是find方法来使emergency_restart_threshold在需要时自动重启php5-fpm。 然后我可以睡觉,并find潜在的PHP问题。 这个问题在过去24小时里发生了21次。 有时甚至相隔3.5小时,其他时间只有几分钟。 我已经尝试过不同的时间值,但到目前为止似乎没有触发所需的SIGSEGV或SIGBUS信号。 看起来问题一旦出现,所有的PHP请求都会挂起,就好像它们都在等待什么东西一样,150个最大的孩子最终会在各种超时closures之前填满传入的请求。 除了这个问题发生的时候,通常只有2-5个孩子需要满足现在的交通。 服务器规格 服务器是运行Ubuntu 14.04的Amazon EC2 c4.Xlarge(7.3 Gb RAM,4 vCPU)。 我也安装了New Relic,资源看起来非常好。 超过一半的内存可用,CPU使用率通常远低于50%,除了PHP5-FPM挂起之后。 各种configuration文件,因为我目前有他们configuration 等/ apache2的/ apache2.conf Mutex file:${APACHE_LOCK_DIR} default PidFile ${APACHE_PID_FILE} Timeout 40 KeepAlive On MaxKeepAliveRequests 250 KeepAliveTimeout 6 User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} HostnameLookups Off ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel error IncludeOptional mods-enabled/*.load IncludeOptional mods-enabled/*.conf Include ports.conf <Directory […]

ProxyPassMatch和mod_rewrite的操作顺序

我在Apache文件夹模式下遇到了Apache 2.4,PHP-FPM和Wordpress Multi用户的情况。 所有非* .php文件都可以在子文件夹中正常工作,就像主要的example.com/subblog/ url一样,但是任何带有.php的文件,如example.com/subblog/wp-login.php都会失败,并且File Not Found来自PHP-FPM。 mod_rewrite文件是: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ – [L] RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [PT] RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [PT] RewriteRule […]

Nginx Varnish 4.0 SSL WordPressconfiguration将mydomain.tldredirect到https://127.0.0.1

我有以下的堆栈: (redirecthttp为https =>)https nginx – > varnish – > nginx http – > php5-fpm 当我打开my.url.com时,我立即redirect到https://127.0.0.1 没有清漆,nginx,ssl,php5-fpm(php 5.5)工作得很好… 我认为它与我的清漆configuration有关,因为几乎相同的堆栈运行不同的CMS(TYPO3 Neos)和不同的清漆configuration就好了…(对于nginx的设置几乎是相同的,只是一些轻微的适应,如静态重写) 我很感激你的想法和反馈! 我的nginxconfiguration: # redirect non-www – http and other domains to www – https server { listen 80; ## listen for ipv4; this line is default and implied server_name domain.com some.other.tld; return 301 https://www.domain.com$request_uri; } # […]

没有input文件指定与嵌套的Docroot

我有以下nginxconfiguration2个不同的域名: server { listen 80; root /srv/users/serverpilot/apps/myapp/public; index index.php index.html index.htm; server_name domain.com www.domain.com; location / { try_files $uri $uri/ @route; } location @route { rewrite ^/(.+)$ /index.php?_route_=$1 last; } location ~ \.php$ { try_files $uri /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/srv/users/serverpilot/run/myapp.php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } 我在使用ServerPilot作为我的控制面板的DigitalOcean Ubuntu 14.04 x64液滴上。 […]

Nginx升级到1.8 – 现在得到502坏的网关

今天我把我的本地主机服务器从nginx 1.6.3升级到了1.8.0,现在我所有的本地网站都得到了一个502坏的网关。 一个标准的nginxconfiguration文件如下 server { charset utf-8; client_max_body_size 128M; listen 80; ## listen for ipv4 server_name yii2.dive; root /media/Development/www/yii2/web; index index.php; access_log /media/Development/www/yii2/log/access.log combined; error_log /media/Development/www/yii2/log/error.log warn; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include fastcgi.conf; #fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; try_files $uri =404; } location ~ /\.(ht|svn|git) { […]

PHP FPM如何监控max_children被超出?

我已经设置了PHP-FPM和Nginx状态输出,目的是监视特定池上超出的max_children。 但是,当达到最大子女数量时,我无法加载状态输出。 而是排队请求,直到孩子完成。 这是什么解决scheme?

PEAR邮件错误似乎崩溃了服务器(php-fpm):504坏的网关

我已经在这个问题上运行了几天。 除了通常的系统/安全更新之外,我没有进行configuration更改。 服务器在Debian Wheezy上运行 PHP 5.4.41-1〜dotdeb + 7.1 Nginx 1.8.0-1〜dotdeb + 7.1 我正在运行一个PHP / Postgresql应用程序。 Nginx在chrooted环境中使用php-fpm。 我花了一些时间来隔离我的用户上周开始得到的504错误网关错误的原因。 php-fpm的日志显示了那种错误: 2015/05/28 15:19:32 [error] 6393#6393: *792 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 90.50.31.149, server: www.myhost.com, request: "POST /myapp/?page=account&password HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.mypool.sock", host: "www.myhost.com", referrer: "https://www.myhost.com/myapp/?page=account&password" 经过一番Googlesearch之后,我提出了php-fpm的能力: pm.max_children = 70 pm.start_servers […]

Apacheconfiguration为mpm_worker – 为什么它仍然显示为mpm_prefork?

我相信我在Ubuntu 13.10下正确configuration了Apache MPM,包括PHP-FPM和FCGI,并禁用了mod_php。 当我运行顶部时,我可以清楚地看到多个Apache(〜2-3 MB)和php(〜25-30 MB)进程在运行,随着用户/请求的增加而增加。 现在,令我困惑的是,当我用a2查询-M返回时: prefork 或者用apachectl -V : Server MPM: prefork threaded: no forked: yes (variable process count) 这个可以吗? 还是我错过了一些设置?