我最近使用 apache 配置了加速器和 fastcgi:http : //secure-ubuntu-server.blogspot.com/2009/07/howto-performance-tuning-of-lamp-and.html
现在我的 Apache 永远不会启动。
日志显示:
Mon Jul 20 16:12:24 2009] [notice] ModSecurity for Apache/2.5.6 (http://www.modsecurity.org/) configured.
[Mon Jul 20 16:12:25 2009] [notice] FastCGI: process manager initialized (pid 10919)
[Mon Jul 20 16:12:25 2009] [alert] FastCGI: read() from pipe failed (0)
[Mon Jul 20 16:12:25 2009] [alert] FastCGI: the PM is shutting down, Apache seems to have disappeared - bye
Run Code Online (Sandbox Code Playgroud) 我在虚拟机上运行了 nginx,我想运行一个 Trac 站点。我需要运行一个Python FastCGI的服务器,但我不能告诉它的使用服务器。我发现了以下内容:
是否有任何最近的设置指南?Trac 自己的 FastCGI 设置页面似乎遗漏了一些步骤。
我最近切换到 PHP(Apache2-worker 和mod_fcgid)的 FastCGI 设置。但是,当单个 PHP 脚本非常繁忙时,它似乎会阻止所有其他 PHP 请求。我的配置会有什么问题?
我使用的主要原因mod_fcgid是为了控制 PHP 内存使用。使用mod_php,所有单独的 Apache 分支在为 PHP 提供服务后都会在内存中增长。
我还切换到 apache2-worker 模型,因为所有线程不安全的 PHP 代码都存在于 Apache 之外。
我的 FastCGI 脚本如下所示:
#!/bin/sh
#export PHPRC=/etc/php/fastcgi/
export PHP_FCGI_CHILDREN=5
export PHP_FCGI_MAX_REQUESTS=5000
global_root=/srv/www/vhosts.d/
exec /usr/bin/php-cgi5 \
-d open_basedir=$global_root:/tmp:/usr/share/php5:/var/lib/php5 \
-d disable_functions="exec,shell_exec,system"
Run Code Online (Sandbox Code Playgroud)
我的 Apache 配置如下所示:
<IfModule fcgid_module>
FcgidIPCDir /var/lib/apache2/fcgid/
FcgidProcessTableFile /var/lib/apache2/fcgid/shm
FcgidMaxProcessesPerClass 1
FcgidInitialEnv RAILS_ENV production
FcgidIOTimeout 600
AddHandler fcgid-script .fcgi
FcgidConnectTimeout 20
MaxRequestLen 16777216
<FilesMatch "\.php$">
AddHandler fcgid-script .php
Options +ExecCGI
FcgidWrapper /srv/www/cgi-bin/php5-wrapper.sh …Run Code Online (Sandbox Code Playgroud) 目标是能够执行存储在 WWW 目录中的任意脚本文件,例如http://www.example.com/*.py.
我不想为每个请求生成一个新的 Python 实例(解释器)(就像在常规 CGI 中所做的那样,如果我没记错的话),这就是我使用 FastCGI 的原因。
根据Lighttpd 的文档,以下是我的配置文件的 FastCGI 部分。问题是它总是/usr/local/bin/python-fcgi为每个 *.py 文件运行脚本,而不管该文件的内容如何:
http://www.example.com/script.py [output=>] "python-fcgi: test"
(无论内容如何script.py)
我对使用任何框架不感兴趣,而只是执行单独的 [web] 脚本。
我怎样才能让它像 PHP 一样运行,通过请求它的路径来执行 WWW 目录中的任何脚本?
/etc/lighttpd/conf.d/fastcgi.conf:
server.modules += ( "mod_fastcgi" )
index-file.names += ( "index.php" )
fastcgi.server = (
".php" => (
"localhost" => (
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/run/lighttpd/php-fastcgi.sock",
"max-procs" => 4, # default value
"bin-environment" => ( …Run Code Online (Sandbox Code Playgroud) 我使用我的 nginx 1.0.15 网络服务器设置了 Mono 2.11,该网络服务器在 centos 6.2 上运行。我从源代码构建它,xps2、xps4 和 fastcgi-mono-server2 按预期工作。问题是当我尝试运行 fastcgi-mono-server4 时。当我运行时:
fastcgi-mono-server4 /applications=site:/:/srv/www/html/ /socket=tcp:127.0.0.1:9000 /loglevels=Debug /printlog=true
Run Code Online (Sandbox Code Playgroud)
这是我从 fastcgi-mono-server2 得到的:
[2012-06-06 23:51:07Z] Debug Record received. (Type: BeginRequest, ID: 1, Length: 8)
[2012-06-06 23:51:07Z] Debug Record received. (Type: Params, ID: 1, Length: 801)
[2012-06-06 23:51:07Z] Debug Record received. (Type: Params, ID: 1, Length: 0)
[2012-06-06 23:51:07Z] Debug Read parameter. (QUERY_STRING = )
[2012-06-06 23:51:07Z] Debug Read parameter. (REQUEST_METHOD = GET)
[2012-06-06 23:51:07Z] Debug Read parameter. (CONTENT_TYPE = )
[2012-06-06 …Run Code Online (Sandbox Code Playgroud) 我有一个运行 nginx + php-fpm + fastcgi 的 Debian Squeeze 服务器。我在这台服务器上安装了一个 typo3,它运行良好。
不,我安装了 OTRS,但收到一个我不明白的错误:
2012/06/25 15:35:38 [错误] 16510#0: * 34 FastCGI 在标准错误中发送:“访问脚本‘/opt/otrs/bin/fcgi-bin/index.pl’已被拒绝(请参阅security.limit_extensions)”,同时从上游读取响应头,客户端:...,服务器:support....com,请求:“GET /otrs/index.pl HTTP/1.1”,上游:“fastcgi:// 127.0.0.1:9000", 主机: "support...com", 引用: " http://support...com/ "
为什么我会收到这个错误?otrs 目录对于网络服务器是可写的,所以这不是问题。有任何想法吗?
在 php.ini 我已经设置
open_basedir = /home/user/web/
Run Code Online (Sandbox Code Playgroud)
现在我想在需要包含来自 /usr/share/phppgadmin 的文件的子域上运行 phppgadmin。
因此,我在此主机的 nginx-config 中添加了以下行:
fastcgi_param PHP_VALUE open_basedir="/home/user/web/:/usr/share/phppgadmin/";
Run Code Online (Sandbox Code Playgroud)
并重新启动nginx。但是,由于以下错误,我无法访问该站点:
[错误] 31440#0: *1 FastCGI 发送到 stderr: "PHP 警告: include_once(): open_basedir 限制生效。文件(/usr/share/phppgadmin/libraries/lib.inc.php) 不在允许的路径内(s): (/home/user/web/)在 /usr/share/phppgadmin/info.php 第 10 行
此处未列出第二条路径的原因可能是什么?将 open_basedir 添加到虚拟主机还需要什么?我只使用了 /sites-available 中的默认文件。
编辑总是想到重新启动fpm ...
service php5-fpm restart
Run Code Online (Sandbox Code Playgroud) 我有多个运行 Wordpress 的虚拟网站,但这个网站开始抛出错误,我无法找到问题所在。
阿帕奇 说:
[Tue Jul 30 14:13:40 2013] [error] [client 82.100.0.70] FastCGI: comm with server "/var/www/uzivatel/www.domena.xy.php5-fcgi" aborted: idle timeout (30 sec)
[Tue Jul 30 14:13:40 2013] [error] [client 82.100.0.70] FastCGI: incomplete headers (0 bytes) received from server "/var/www/uzivatel/www.domena.xy.php5-fcgi"
Run Code Online (Sandbox Code Playgroud)
但是PHP-FPM日志是可以的(它是在请求后的几毫秒内生成的):
- - 30/Jul/2013:14:13:10 +0200 "GET /index.php" 200 /var/www/uzivatel/webs/www.domena.xy/index.php 793.871 35072 37.79/30.23
Run Code Online (Sandbox Code Playgroud)
有代码 200,所以页面似乎被正确创建,但 Apache 的行为就像没有来自 fastcgi 服务器的回复。
但有趣的是,当我之前剪切页面生成时,apache 将其正确返回给客户端。但是如果我<?php die(); ?>在标签之后插入,也会发生同样的错误。
有没有办法调试apache和fastcgi服务器之间的通信?
这是配置(相同的配置适用于另一个虚拟网站):
<VirtualHost 1.2.3.4:80>
ServerName www.domena.xy
DocumentRoot /var/www/uzivatel/webs/www.domena.xy/
FastCgiExternalServer /var/www/uzivatel/www.domena.xy.php5-fcgi -socket /tmp/php-fpm/php-www.domena.xy.socket -pass-header Authorization
Action php5-fcgi …Run Code Online (Sandbox Code Playgroud) 我通过fcgiwrap与nginx. 由于脚本被编译,我可以在编译过程中得到编码错误,但有时我收到CGI错误只是说明
An error occurred while reading CGI reply (no response received)
Run Code Online (Sandbox Code Playgroud)
是否有任何调试方法可以识别 CGI 请求/进程有什么问题?
如何设置调试系统以将错误传送到 nginx 日志中?
我们有运行 nginx 7.65 和 fastcgi PHP5 的网络服务器,并且正在研究缓存的可能性,以加快内容交付和降低系统负载。服务器运行不同的(自定义)应用程序。
缓存的选项太多了,我不确定什么是合理的设置。有memcached、APC、Nginx的fastcgi_cache、proxy_cache....
我知道 memcached 具有分布式能力作为奖励,但我们目前不需要它。根据我的经验,如果将 memcached 安装在它所服务的同一台机器上,它的执行速度比 APC 慢,但这是一段时间以前的事了。
我不熟悉 Nginx fastcgi_cache 甚至常规的 proxy_cache 模块。它是可比的还是完全不同的?
对于 Nginx w,什么是好的、合理的缓存方法。FastCGI PHP5?