Articles of php fpm

在Centos 6上设置Apache 2.2 + FastCGI + SuExec + PHP-FPM

我试图在这里遵循这个非常详细的说明 ,我只是从www-data用户更改为apache用户,并使用/ var / www / hosts / sitename / public_html而不是/ home / user / public_html 不过,我花了整整一天的时间,试图找出为什么php文件内容显示不正确的分析。 我似乎无法解决这个问题。 以下是我目前的configuration: /etc/httpd/conf.d/fastcgi.conf User apache Group apache LoadModule fastcgi_module modules/mod_fastcgi.so # dir for IPC socket files FastCgiIpcDir /var/run/mod_fastcgi # wrap all fastcgi script calls in suexec FastCgiWrapper On # global FastCgiConfig can be overridden by FastCgiServer options in […]

NGINX / PHP-FPM通过https / SSL访问非常缓慢

从一个星期前开始,我开始注意到我的web应用程序的糟糕performance。 我的应用程序在Amazon EC2 m1.large实例上提供。 只有4-5kb的静态文件通常需要超过10秒才能收到。 这会间歇性地发生,但是对于每一个页面加载,我可以预期至less有一两个特定资源的等待时间。 从检查Firebug很显然,抢劫处于请求的“等待”部分。 (DNS /连接/发送和接收总是很好) 不幸的是,我还没有发布图片所需的信誉,或者我会。 更糟糕的是,当一个页面请求大量的静态资源,比如Images时,几乎每一个请求都会出现这个问题。 玩过我的NGINX和PHP-FPMconfiguration后,在上个星期左右,我才发现只有在通过HTTPS访问服务器时,问题才出现。 使用ab命令testing性能时可以看到这一点。 HTTPS: ab -c 100 -n 3000 https://www.mydomain.com/ Server Port: 443 SSL/TLS Protocol: TLSv1,RC4-SHA,2048,128 Document Path: / Document Length: 13367 bytes Concurrency Level: 100 Time taken for tests: 12.122 seconds Complete requests: 3000 Failed requests: 0 Write errors: 0 Total transferred: 41205000 bytes […]

使PHP-FPM在'IPAddress:Port'处听,而不是'/var/run/php5-fpm.sock;'

正如我今天负载testing我的网站(使用blitz.io ); 尽pipe有大量的RAM(超过50%)和CPU能力(超过70%)可用,但结果表明,我的网站以每秒一定数量的并发用户开始超时。 我的网站(/var/log/nginx/example.com.error.log)的Nginx错误日志显示如下: 2013/02/12 19:03:57 [error] 13749#0:* 3175连接()到unix:/var/run/php5-fpm.sock失败(11:资源暂时不可用) 54.123.456.46,服务器:example.com,请求:“GET / HTTP / 1.1”,上游:“fastcgi:// unix:/var/run/php5-fpm.sock:”,主机:“example.com” 谷歌search的错误导致我这个答案 ,使用TCP \ IP连接,而不是unix套接字作为问题的解决scheme; 因为unix socket的“高负载情况下的问题是众所周知的” 。 所以,正如答案所build议的那样: 我用/etc/php5/fpm/pool.d/www.conf中的listen 127.0.0.1:9000replace了listen = /var/run/php5-fpm.sock 由于我的分配(Debian Wheezy)上没有/etc/nginx/php_location ,所以我什么也没做。 由于我使用fastcgi_pass unix:/var/run/php5-fpm.sock; 在我的网站的Nginxconfiguration文件中,即/etc/nginx/sites-available/example.com,我用fastcgi_pass 127.0.0.1:9000;取代了它fastcgi_pass 127.0.0.1:9000; 现在的问题是,当我访问我的网站时,出现502 Bad Gateway错误。 是的,我reload Nginx和PHP-FPM。 我究竟做错了什么? (这里总是新手,尽我所能去学习。) 如果这是相关的,当我做sudo service php5-fpm restart ,我得到这个错误: [FAIL] Restarting PHP5 FastCGI Process Manager: php5-fpm failed! […]

CentOS 6.6 with Nginx 1.6.2 – 突然无法重启nginx – nginx: open()“/ usr / share / nginx / on”失败(13:Permission denied)

这是一个新的安装,其中nginx先前正常启动和停止。 我相信这个错误是在启用testing成功的服务器模块(nginx -t)之后出现的。 然后我尝试重新启动nginx并收到此错误: nginx: [emerg] open() "/usr/share/nginx/on" failed (13: Permission denied) 在尝试重新启动之前,文件“on”不存在。 它刚刚创build,是空的。 当我重新启动php-fmp(成功),然后尝试再次重新启动nginx时,错误更改为: nginx: [emerg] open() "/var/run/nginx.pid" failed (13: Permission denied) nginx: configuration file /etc/nginx/nginx.conf test failed 但是,当我运行nginx -t时,testing成功: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful 我认为这可能是一个用户问题,但一切似乎很好: # ps -elf | grep nginx 5 S […]

不显示Php-fpm状态页面

我试图得到php-fpm状态页面。 当我在网页浏览器中打开/状态页面或直接到fcgi – 它说没有find文件。 你能帮助 – 如何解决这个问题。 # grep -ER "status|ping" /etc/php5/* | grep -v ":;" /etc/php5/fpm/pool.d/www.conf:pm.status_path = /status /etc/php5/fpm/pool.d/www.conf:ping.path = /ping /etc/php5/fpm/pool.d/www.conf:ping.response = pong # SCRIPT_NAME=/status SCRIPT_FILENAME=/status QUERY_STRING= REQUEST_METHOD=GET cgi-fcgi -bind -connect /var/run/php-fpm-www.sock Primary script unknown Status: 404 Not Found Content-type: text/html File not found. # SCRIPT_NAME=/ping SCRIPT_FILENAME=/ping REQUEST_METHOD=GET cgi-fcgi -bind -connect /var/run/php-fpm-www.sock Primary […]

我如何追踪php-fpm终止的原因?

我有VPS(4核心,6GB)运行centos,nginx和php-fpm,很lessstream量(我从来没有发布的url)。 每隔几周(在不同的时间),php-fpm在php-fpm.log中仅以下列方式终止: [10-Nov-2015 04:14:48] NOTICE: Terminating … [10-Nov-2015 04:14:48] NOTICE: exiting, bye-bye! 目前在nginx error.log或php-fpm-error.log中没有其他事件。 我还能在哪里find终止的原因? 有什么我可以configuration的,下次发生的时候会给我更多的信息吗? 我可以configurationphp-fpm自动重启吗?

如何设置在WordPress上传媒体的权限? (Ubuntu 14.04.1,nginx 1.4.6)

我无法find在我的液滴上运行WordPress网站的正确权限。 我遵循本指南来configuration站点: 如何在Ubuntu上configurationWordPress的安全更新和安装 configuration如下: Ubuntu 14.04,nginx 1.4.6 nginx用户是www-data /var/www/*由wp-user:wp-user 目录设置为755 ,文件为644 ( WordPress文档 ) 安全更新和主题/插件安装按预期工作,但尝试通过Web界面上载新媒体时收到以下错误: Unable to create directory wp-content/uploads/2014/11. Is its parent directory writable by the server? Unable to create directory wp-content/uploads/2014/11. Is its parent directory writable by the server? 任何想法,我怎么可以configuration所有者/权限来允许(同时保持安全)?

对于空目录,nginx 404而不是403

我有我的nginx服务器的以下configuration: server { listen 80 default_server; server_name example.com www.example.com; root /var/www/example.com/web; index index.php index.html; location / { # try to serve file directly, fallback to rewrite try_files $uri $uri/ @rewriteapp; } location @rewriteapp { # rewrite all to index.php rewrite ^(.*)$ /index.php last; } location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param […]

我如何在多个Nginx服务器块中重新使用PHPconfiguration指令?

所以我有Nginx和PHP-FPM服务于不同领域的多个网站。 由于在每个server { }块中重复的location ~ \.php$ { }块,configuration文件变得非常大: server { listen 80; server_name firstsite.com; root /var/www/firstsite; location ~ \.php$ { root /var/www/firstsite; try_files $uri =404; fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } server { listen 80; server_name secondsite.com; root /var/www/secondsite; location ~ \.php$ { root /var/www/secondsite; try_files $uri =404; fastcgi_pass 127.0.0.1:9001; […]

php-fpm保持locking状态

出于某种原因,php-fpm保持locking和/或悬挂。 它有一段时间的工作,然后在试图加载网页时,它会随机地“挂”很长一段时间。 我的php-fpm.log中绝对没有关于它的内容,我不知道如何找出问题。 你们能帮我把它指向一个新的方向吗? CentOS 6.2 [root@3AC19 ~]# php-fpm -v PHP 5.3.9 (fpm-fcgi) (built: Jul 5 2012 04:04:34)