我有一个在Django运行的网站.前端是lighttpd,正在使用fcgi来托管django.
我开始我的fcgi进程如下:
python2.6 /<snip>/manage.py runfcgi maxrequests=10 host=127.0.0.1 port=8000 pidfile=django.pid
Run Code Online (Sandbox Code Playgroud)
对于日志记录,我有一个RotatingFileHandler定义如下:
file_handler = RotatingFileHandler(filename, maxBytes=10*1024*1024, backupCount=5,encoding='utf-8')
Run Code Online (Sandbox Code Playgroud)
记录正在运行.但是,当它们甚至没有达到10Kb时,看起来文件正在旋转,更不用说10Mb了.我的猜测是每个fcgi实例只处理10个请求,然后重新生成.每个重生的fcgi都会创建一个新文件.我确认fcgi经常在新的进程id下启动(很难准确地说出时间,但是在一分钟之内).
有没有办法解决这个问题?我希望所有fcgi实例都记录到一个文件,直到达到大小限制,此时将发生日志文件轮换.
我试图在Apache上使用FastCGI(实际上是fcgid)配置Python迷你框架CherryPy.我在共享主机上,所以我无法访问httpd.conf,只有htaccess.我遵循这些教程无济于事:
我不断收到500条错误,而Apache日志上写着"脚本标题过早结束".我已经尝试了一切(权限/ shebangs/full-paths/deamonized/not-daimonized).我知道Apache正在执行我的.fcgi,因为我能够从python打印到错误日志,但就是这样.之前有没有人在共享主机上成功安装过CherryPy或任何其他框架?非常感谢您的帮助.谢谢.
我问的是一个运行轻型前端的Web服务器(在我的例子中是nginx),通过fastcgi访问PHP进程.
我试图找到一种方法来有条不紊地计算应该在机器中运行多少PHP cgi进程.
考虑它的一种方法是计算出一个进程的平均内存占用量,并在可用RAM的限制范围内尽可能多地运行.但是,这并没有将CPU使用率带入问题.
由于CPU是我应用程序中的真正瓶颈(使用DB和memcache,但不是瓶颈),我认为php进程的基数应该是可用的CPU数量.
例如 - 在8核机器中,基数为8.假设某些进程等待数据库或网络,我认为没有任何理由共同运行超过20个PHP进程.
这种思维方式有意义吗?你如何计算运行的进程数?
我正在开发一个应该通过http连接的小型服务器.由于我希望它可以与不同的成熟http服务器一起使用,我选择了FastCGI作为通用接口.
现在我找不到一个实现FCGI接口的(免费).NET库,并为我做了所有艰苦的工作.你知道吗?
我试图将运行symfony框架的php网站迁移到nginx和php over fastcgi.
从http://wiki.nginx.org/开始使用Symfony howto一切正常,但我遇到了自定义重写规则的问题.
我的目标是将/ aaaa形式的URL重写为/ view/shorthand/aaaa.然后应该由php和symfony对请求进行处理.
旧的apache重写规则:
RewriteRule ^([0-9a-f]+)$ index.php/view/shorthand/$1 [L]
Run Code Online (Sandbox Code Playgroud)
我尝试过的Nginx规则:
rewrite ^/([0-9a-f]+)$ /view/shorthand/$1 break;
rewrite ^/([0-9a-f]+)$ /index.php/view/shorthand/$1 break;
Run Code Online (Sandbox Code Playgroud)
他们都被发送到fastcgi但是request_uri似乎仍然是/ aaaa,因为我收到此错误:
FastCGI sent in stderr: "Action "aaaa/index" does not exist" while reading response header from upstream
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用try_files而没有任何运气.请指教.
我从/var/log/messagesFreeBSD盒中收到此错误。我使用nginx和spawn-fcgi用memcache和apc启用的模块。
upstream prematurely closed connection while reading response header from upstream,
client HTTP/1.1", upstream: "fastcgi://unix:/tmp/fcgi.sock:", host:
Run Code Online (Sandbox Code Playgroud) 我正在使用nginx上的FastCGI在C++中创建一个网站.我现在的问题是跟踪用户(也称为会话).我可以读出HTTP_COOKIE,但我不知道如何创建一个带有名称和值的新cookie并将其发送给客户端.
在Google中查找我只发现了PHP,Python和其他尝试使用CGI/fCGI运行的脚本语言的相关内容.
在Code_gniter的Fast-cgi环境中遇到mod_rewrite问题.我的.htaccess看起来像这样:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\\.php|images|css|js|robots\\.txt|favicon\\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
Run Code Online (Sandbox Code Playgroud)
但我得到一个错误'没有指定输入文件'.
我换了
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.* - [L]
RewriteCond $1 !^(index\.php|images|robots\.txt)
#RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
它也适用于这个:
#RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
Run Code Online (Sandbox Code Playgroud)
我的问题是,如果我从$ config ['index_page'] ='index.php'更改配置文件application/config/config.php,我仍然在URL上有index.php; to $ config ['index_page'] =''; 我有一个不同的错误.
我做错了什么?
PHP7 PHP-FPM
cgi.fix_pathinfo = 0
Run Code Online (Sandbox Code Playgroud)
什么时候
cgi.fix_pathinfo = 1
Run Code Online (Sandbox Code Playgroud)
一切正常
我正在尝试使用IIS在Windows 2012服务器上部署Django应用程序.我的web.config文件:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="Django Handler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Users\chinmay_arima\env_resolution\Scripts\python.exe|C:\Users\chinmay_arima\env_resolution\Lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
获取"HTTP错误500 - 内部服务器错误".请找到附件以查看错误.使用Django版本:2和IIS版本:8.5我按照以下链接:http: //blog.mattwoodward.com/2016/07/running-django-application-on-windows.html 请帮帮我,我需要使用IIS服务器在Windows上部署Django应用程序.