我不确定这是 Nginx 或 PHP-FPM 设置,但长日志行被截断。是否有增加最大日志行长度的设置?
我正在尝试设置一个可以通过 HTTP(S) 访问我的 git repo 的服务器。
我正在使用 gitolite 和 nginx(以及用于 Web 界面的 gitlab,但我怀疑它有什么区别)。
我搜索了整个下午,我想我被卡住了。
我想我已经明白 nginx 需要 fcgiwrap 才能与 gitolite 一起工作,所以我尝试了几种配置,但都没有工作。
我的存储库位于 /home/git/repositories。
这是我尝试过的三种 nginx 配置。
1:
location ~ /git(/.*) {
gzip off;
root /usr/lib/git-core;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include /etc/nginx/fcgiwrap.conf;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param DOCUMENT_ROOT /usr/lib/git-core/;
fastcgi_param SCRIPT_NAME git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /home/git/repositories;
fastcgi_param PATH_INFO $1;
#fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
Run Code Online (Sandbox Code Playgroud)
结果:
> git clone http://myservername/projectname.git test/
Cloning into test...
fatal: http://myservername/projectname.git/info/refs not found: did you run git update-server-info on …
Run Code Online (Sandbox Code Playgroud) 我正在迁移我的服务器以使用 mod_proxy_fcgi 和 php-fpm 而不是 mod_php。Apache 能够将 .php 请求转发到 fcgi 代理,并且 PHP 可以正确执行。我有这个工作:
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
Run Code Online (Sandbox Code Playgroud)
不幸的是,即使文件不存在,Apache 也会将所有 .php 请求转发给代理。这会导致一些问题。我的 ErrorDocument 规则没有被调用,DirectoryIndex index.php index.html
也没有回退到 index.html。
我能够使用 mod_rewrite 解决这些问题:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} ^/((.*\.php)(/.*)?)$
RewriteCond /var/www/html/%2 -f
RewriteRule . fcgi://127.0.0.1:9000/var/www/html/%1 [P]
Run Code Online (Sandbox Code Playgroud)
但是,Apache 文档不推荐 RewriteRule:“这是因为此标志触发了默认工作程序的使用,该工作程序不处理连接池。”
理想情况下,我想我要么想在 FilesMatch 块中使用 ProxyPass(目前不受支持),要么定义一个新的处理程序,通过 fcgi 代理并使用它来处理 .php 请求,类似于 mod_php 所做的。
任何模拟标准 mod_php 设置但实际上通过 fcgi 代理的建议?
有一个PHP5.3.3 错误,它不允许我通过 Apache2 查看 php-fpm 的 /status 页面。有没有办法手动访问这些数据?我无法升级盒子(不支持 Ubuntu 10.10,php5.3.4)。
我试过使用这里的技术进行连接:http : //inode.co.nz/testing-a-fastcgi-service,但没有运气。
我有一个在 127.0.0.1:9000 上运行的“hello world”fastcgi,并希望通过 nginx 为其提供服务。我将以下几行添加到 nginx.conf http 块中:
server {
listen public.ip.address.here:80;
server_name $host;
location / {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我没有得到 fastcgi 的输出,而是只得到 502 Bad Gateway 响应。
error_log 说:[error] 1924#0: *1 upstream prematurely closed FastCGI stdout while reading response header from upstream, client: myIP, server: $host, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "public.ip.address.here"
我不确定这是 php、apache 还是 iptables 配置问题,但在尝试访问.php
文件时收到以下错误。如果您需要更多信息来帮助我诊断,请告诉我,我不知道接下来要检查什么。谢谢你。
error.log
:
[Thu May 08 16:43:15.392784 2014] [proxy:error] [pid 23112] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9000 (*) failed
[Thu May 08 16:43:15.392891 2014] [proxy_fcgi:error] [pid 23112] [client 74.164.254.206:52788] AH01079: failed to make connection to backend: 127.0.0.1
Run Code Online (Sandbox Code Playgroud)
我按照本指南和运行的 PHP 5.5.9 和 Apache 2.4.7
我确实加载了mod_proxy
和mod_proxy_so
模块:
# grep LoadModule /etc/apache2/apache2.conf
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_fcgi_module /usr/lib/apache2/modules/mod_proxy_fcgi.so
Run Code Online (Sandbox Code Playgroud)
这是 ProxyPassMatch 指令:
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/$1
Run Code Online (Sandbox Code Playgroud)
我还尝试将 UDS 与以下指令一起使用,但 apache 配置测试抱怨绝对 …