我正在将所有服务器的日志轮转任务移动到logrotate。 服务器有几个PHP-FPM池,每个池都configuration了一个单独的error_log指令。 日志的logrotate配方相当简单: /var/log/php/*.log { rotate 7 daily missingok notifempty delaycompress compress dateext sharedscripts postrotate # Need for signaling the php-fpm process? endscript } 我应该向php-fpm池发送一些信号来捕获error_log文件的新句柄(在postrotate脚本中)? 如果是,哪个信号?
我在.ini文件中做了一些修改,并想重新启动php5-fpm。 /etc/init.d/php5-fpm重启 1月20 14:25:48.171577地址错误[错误] bind()/var/lib/php5-fpm/apps.sock失败:地址已经在使用(98) 我怎样才能找出使用这个地址的是什么? 我已经停止nginx,但没有任何改变。
我有Nginx安装程序来反向代理以.php结尾的所有文件。 在一些脚本中,我检查参数,并发送“406不可接受”作为一个通用的错误,这需要从Ajax的jQuery /拾起。 我可以改变这个错误,但我希望能够把它发送到客户端。 如果我发送406,Nginx会将其更改为502 Bad Gateway并注入它自己的错误消息。 它虽然适用于404和403,但这些错误在这种情况下并不真正“适用” 这是一个API,所以被禁止是不好的RESTful实践。 我尝试使用fastcgi_intercept_errors,但似乎没有区别。 我正在使用Nginx 0.7 。 PHP的一部分: header($_SERVER['SERVER_PROTOCOL'] . '406 Not Acceptable'); echo '{"error":"Missing Params"}'; exit; Nginxconfiguration location ~ .php$ { fastcgi_intercept_errors on; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
是否可以在一个位置块中设置超时指令,以防止nginx从长时间运行的PHP脚本(PHP-FPM)返回504? server { listen 80; server_name ubuntu-vm.test-api; root /home/me/Sites/path/to/site/; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { try_files $uri =404; # Fix for server variables that behave differently under nginx/php-fpm than typically expected fastcgi_split_path_info ^(.+\.php)(/.+)$; # Include the standard fastcgi_params file included with nginx include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; […]
nginx安装随附的/etc/nginx/sites-available/default文件具有以下内容: # You may add here your # server { # … # } # statements for each of your virtual hosts to this file ## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. […]
亲爱的ServerFault社区,我设法使我的网站进入一个全function状态两天前..大约3小时前,今天,我已经重新启动我的Linux机器,并发现我的网站不再工作。 我不知道这是为什么,坦率地说,我只是不认为我现在正在解决它的水平 – 我真的可以做你的帮助:) 基本上我所有的Nginx的PHP文件呈现为空白或陈述'权限被拒绝' 前几天PHP-FPM工作正常…现在我得到这个错误! 自从我今天重新启动以来,我的网站一直在正常工作! 格儿。 看我的错误日志,我可以看到: while reading response header from upstream '2014/12/09 21:35:50 [error] 1945#0: *1 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Unable to open primary script: /usr/share/nginx/html/phpinfo.php (Permission denied)" while reading response header from upstream, client: […]
我遇到了麻烦,我的php-fpm设置。 也许你们可以把我指向正确的方向。 首先,一切工作正常。 但时不时地,我会得到503错误。 一旦我重新加载网站,这些错误就消失了。 他们只出现在php网站,并没有孤立到一个域或一个框架。 我收到了PHPmyAdmin,Wordpress和Typo3中的503错误。 那些是我testing的3个站点。 他们是在单独的虚拟主机,并有不同的PHP-FMP池,但他们共享相同的PHP-FPM主要步骤。 我运行的服务器是Apache 2.4(MPM-Event Workers),没有mod_php或者cgi / fastcgi。 相反,我使用mod_proxy和mod_proxy_fcgi将每个.php文件传递给我的php-fpm进程。 有一点要注意的是,服务器还没有投入生产,所以几乎没有任何stream量。 服务器硬件是强大的,12个VCores和32 GB的RAM。 我的mod_proxy和mod_proxy_fcgi设置是默认的 – 我没有改变任何东西。 我的虚拟主机configuration(代理部分): <FilesMatch "\.php$"> SetHandler "proxy:unix:///opt/php-5.6.11/var/run/php5-fpm-mywebsite.sock|fcgi://mywebsite/" </FilesMatch> <Proxy fcgi://mywebsite/ enablereuse=on retry=0> </Proxy> 注意:我以前在Proxy指令中有最多10个,似乎更频繁地产生了503错误。 现在我已经删除了最多= 10,似乎发生less。 虽然可能只是巧合。 我的PHP-FPM池configuration(相关部分): listen = var/run/php5-fpm-mywebsite.sock listen.owner = mywebsite listen.group = www-data listen.mode = 0660 listen.backlog = 65535 user = mywebsite […]
是否有可能为php(cli)和php-fpm创build单独的php.ini文件,就像在debian和ubuntu上可能有两个文件夹/etc/php/7.0/cli和/etc/php/7.0/fpm ? 如果我可以为每个子系统加载一个conf.d目录的独立模块,我也会很酷。 有没有人有一个想法如何可以分别configuration它? 我也尝试使用它在ubuntu 16.04中configuration的结构,但没有成功。
我有一个freebsd服务器上安装了nginx + php-fpm和APC,我遇到了与APC连接不断的问题。 php-fpm冻结在'lockf'状态(在top ),因此网站不工作。 我注意到,通过降低apc.shm_size到默认值30是帮助php-fpm不冻结,但30Mb是不够的,因为我在APC存储了很多variables。 我注意到,提高apc.shm_size为更高的值(如60)使得php-fpm进程使用更多的内存,几乎所有的服务器物理内存,这是奇怪的,因为据我所知,这些60Mb是所有的PHP-FPM之间共享进程,不应该影响每个php-fpm进程的内存使用。 我试图将apc.shm_segments值更改为1以上,并重新启动php-fpm时出现错误: PHP Startup: apc.shm_segments setting ignored in MMAP mode in <b>Unknown</b> on line <b>0</b><br /> Unknown(0) : Warning – PHP Startup: apc.shm_segments setting ignored in MMAP mode 所以请告诉我这些参数如何影响APC,为什么在使用大量共享内存时,php-fpm会死亡? MMAP mode是什么意思? 我想打开xcache,它是与PHP-FPM和足够稳定的生产?
我正在使用基于Debian的主机,并使用Nginx和PHP-FPM,我想在nginx中启用用户目录,并希望多用户支持基本身份validation。 这意味着当亚历克斯打开www.example.com/rutorrent; 这将提示login名和密码,并authentication后,这应该指向自己的版本的PHP脚本位于/ home / alex / www / rutorrent当鲍勃将打开www.example.com/rutorrent;这将提示login和密码和身份validation后,这应该指向他的PHP脚本位于/ home / bob / www / rutorrent。 我已经试过这里的官方文档: http : //wiki.nginx.org/UserDir 但我不知道如何configuration他们到默认文件,以便我可以得到我想要的function,我的默认configuration文件的nginx在这里: server { server_name localhost; location / { try_files $uri $uri/ /index.html; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; allow ::1; deny all; } index index.php index.html index.htm; location ~ ^/~([^/]*)(.*)\.php$ […]