Articles of FastCGI的

如何使用Lighttpd和FastCGI设置Python(如PHP)

在Linux上运行Lighttpd,我希望能够像执行PHP脚本一样执行Python脚本。 目标是能够执行存储在WWW目录中的任意脚本文件,例如http://www.example.com/*.py 。 我不想为每个请求产生一个新的Python实例(解释器)(就像我在常规CGI中做的那样,如果我没有弄错的话),这就是我使用FastCGI的原因。 遵循Lighttpd的文档 ,以下是我的configuration文件的FastCGI部分。 问题是它总是为每个* .py文件运行/usr/local/bin/python-fcgi脚本,而不pipe该文件的内容如何: http://www.example.com/script.py [output=>] "python-fcgi: test" (不pipescript.py的内容如何) 我对使用任何框架不感兴趣,只是执行单个[web]脚本。 我怎样才能使它像PHP一样,通过请求它的path在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" => ( "PHP_FCGI_CHILDREN" => "1", # default […]

启用APC会导致内部服务器错误

在安装并启用APC 3.1.9(备用PHPcaching)后,使用pecl ,我遇到了内部服务器错误。 我检查了我的错误日志,这是什么显示。 错误日志: PHP Fatal error: PHP Startup: apc_mmap: mkstemp on /tmp/apc.efdb4d failed: in Unknown on line 0 [Wed Jul 06 23:47:41 2011] [error] mod_fcgid: process /var/www/cgi-bin/cgi_wrapper/cgi_wrapper(22397) exit(communication error), get unexpected signal 11 我没有将APC扩展添加到我的php.ini文件中, apc.ini在/etc/php.d/创build了一个apc.ini文件,这里是我当前的APCconfiguration apc.iniconfiguration: ; /etc/php.d/apc.ini extension = apc.so apc.enabled = 1 apc.shm_segments = 1 apc.shm_size = 128M apc.optimization = 0 […]

Nginx和PHP的caching:fastcgi_cache,proxy_cache,APC或memcached或组合?

我们有运行nginx 7.65和fastcgi PHP5的web服务器,并正在研究caching的可能性,以加快内容交付和降低系统负载。 服务器运行不同的(自定义)应用程序。 有这么多的caching选项我不知道什么是一个理智的设置。 有memcached,APC,Nginx的fastcgi_cache,proxy_cache …. 我知道memcached具有分发能力作为奖励,但我们现在不需要它。 根据我的经验,如果memcached安装在与服务器相同的机器上,其执行速度会比APC慢,但这是前一段时间。 我不熟悉Nginx的fastcgi_cache甚至是常规的proxy_cache模块。 它可比较还是完全不同? 对于Nginx w来说,一个好的,理智的caching方法是什么。 FastCGI PHP5?

一个单独的php-fastcgi进程阻止所有其他的PHP请求

我最近切换到PHP的FastCGI设置(Apache2-worker和mod_fcgid )。 但是,当一个PHP脚本非常繁忙时,似乎会阻止所有其他PHP请求。 我的configuration有什么问题? 我使用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" 我的Apacheconfiguration如下所示: <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 […]

Nginx中不同的PHPconfiguration

我有一个networking服务器运行多个服务器(虚拟主机)使用nginx和fastcgi传递到unixsockets。 我想完成的是使用beta.example.com和live.example.com进行设置,其中活动站点已closureserror_reporting(但仍然logging到文件),并在beta站点error_reporting处于打开状态。 所以对于Apache我会做一些事情: <VirtualHost *:80> ServerName beta.example.com […] php_flag display_errors on php_flag display_startup_errors on php_value error_reporting -1 […] </VirtualHost> 当使用googling时,我还没有find任何可以使用fastcgi将这些parameter passing给PHP的地方。 有谁知道如何做到这一点? 现在的configuration是(简化): server { server_name beta.example.com; […] fastcgi_pass unix:/var/run/nginx/php-fastcgi.sock; fastcgi_index index.php; }

在Nginx中禁用FastCGI读取超时?

有没有办法来禁止FastCGI读取超时? (fastcgi_read_timeout) 将其设置为零不起作用,只会导致立即超时。 Nginx 1.0.5 PHP-FPM 5.3.6-13ubuntu3.6 我需要解决超时的原因是由于我们使用的系统生成报告的方式。 由于在PHP-FPM中分叉是不可能的(pctnl_fork()被禁用),报告处理在请求被发送后立即完成。 这会导致读取挂起,直到系统完成处理。

Nginx – 为所有主机启用PHP

我目前正在testingnginx,并通过将每个虚拟主机的configuration放置在一个名为sites-enabled的文件夹中的自己的文件中来设置一些虚拟主机。 然后我问nginx加载所有这些configuration文件使用: include C:/nginx/sites-enabled/*.conf; 这是我目前的configuration: http { server_names_hash_bucket_size 64; include mime.types; include C:/nginx/sites-enabled/*.conf; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; root C:/www-root; #charset koi8-r; #access_log logs/host.access.log main; location / { index index.html index.htm index.php; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; […]

Nginx / PHP-FPM长日志行被截断

我不确定这是一个Nginx或PHP-FPM设置,但长日志行被截断。 有没有增加最大日志行长度的设置?

FastCGI错误访问脚本被拒绝

我有一个运行nginx + php-fpm + fastcgi的Debian Squeeze服务器。 我在这台运行良好的服务器上安装了一个typo3安装。 不,我安装了OTRS,我得到一个我不明白的错误: 2012/06/25 15:35:38 [error] 16510#0:* 34在stderr中发送了FastCGI:“脚本”/opt/otrs/bin/fcgi-bin/index.pl“的访问被拒绝security.limit_extensions)“,同时读取来自上游的响应头,client:…,server:support ….. com,请求:”GET /otrs/index.pl HTTP / 1.1“,上游:”fastcgi:// 127.0.0.1:9000“,主机:”support ….. com“,referrer:” http://support…..com/ “ 为什么我得到这个错误? otrs目录是可写的Web服务器,所以这不是问题。 有任何想法吗?

无法在.htaccess文件中设置php_value

我试图在我的Apache2 / PHP服务器上设置NewRelic,并且每个虚拟主机都报告不同的应用程序。 为此,必须更改php值newrelic.appname 。 它是在/etc/php.d/newrelic.ini中默认定义的,但是为了进行虚拟主机报告,需要在该虚拟主机上专门设置,如下所述: https : //newrelic.com/docs/php/per -directory的设置 在我的/etc/php.d/newrelic.ini中设置: newrelic.appname="PHP Application;MySite.com;" 在我的虚拟主机,我有以下configuration: <Directory "/"> AllowOverride All php_value newrelic.appname "MySite.com" </Directory> 而我的.htaccess我有: php_value newrelic.appname 'MySite.com' 但是,从与.htaccess文件所在目录相同的文件中查看phpinfo() ,我得到: Directive Name Local/Active Value Master/Default Value ———————————————————– newrelic.appname PHP Application PHP Application 通过spawn-fcgi使用FastCGI。 任何其他build议将不胜感激。