我新的nginx我的服务器块是 server { listen 25552; server_name *.example.com; root /usr/share/myPackage; rewrite ^/$ /index.php permanent; location ~ ((\.php$)|(^/(status)$)) { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } access_log /var/log/nginx/console-access.log; } 使用浏览器即时获得状态200,而打我的url – www.example.com:25552/index.php和其他的PHP文件相同的状态,但没有在页面中显示。 虽然我尝试更改url,我能够在我的浏览器上获取我的html,js和图像文件。 我认为是我的PHP文件没有得到parsing请帮助我…. 🙂
我有一个Debian喘息的虚拟机基础框,我一直使用vagrant过去几个月没有任何问题,但昨天当我提出了一个新的机器和更新/升级包我开始得到一个FastCGI服务器连接失败错误: [Wed Jun 04 14:39:03 2014] [error] [client 10.0.2.2] (13)Permission denied: FastCGI: failed to connect to server "/vagrant/php5-fcgi": connect() failed [Wed Jun 04 14:39:03 2014] [error] [client 10.0.2.2] FastCGI: incomplete headers (0 bytes) received from server "/vagrant/php5-fcgi" 我能够通过手动触摸和chmodding /tmp/php5-fpm-vagrant.sock临时解决问题,但是我的问题是为什么它突然间开始发生? 撇开个人喜好,有没有什么function上与我的configuration错? 在我的Apache网站可用我有一个名为000php文件包含: FastCgiExternalServer /vagrant/php5-fcgi -socket /tmp/php5-fpm-vagrant.sock -pass-header Authorization 由于Apache按字母顺序加载站点,所以总是先加载,然后我有另一个名为vagrant文件,其中包含: <VirtualHost *:80 *:8080> DocumentRoot /vagrant/public_html/ ServerName vagrant.localhost […]
nginx 文档说,如果fastcgi_keep_conn没有打开,keepalive for fastcgi将无法工作。 但是,我无法find任何进一步的细节。 我已经在服务器范围内启用了Keepalive。 我正在使用php-fpm。 使用fastcgi_keep_conn有什么问题需要注意?
我们正在使用FastCgi在iis上运行多个php站点。某些站点现在产生了许多以高cpu使用率运行的FastCgi实例。 不幸的是,所有的网站都是从networking服务运行的,我们没有看到什么W3WP过程产生了什么FastCgi处理。 有什么方法可以识别FastCgi并将其追踪到特定的AppPool或网站?
我已经读过: 如何从nginxconfiguration$ uri中删除位置块? 但有没有一种方法来剥离位置块的前缀从$ fastcgi_script_name不使用正则expression式? 例如 : location /foo/ { access_log /var/log/nginx/access-truc.log FOO; alias /srv/http/php; fastcgi_pass fpm; fastcgi_index index.php; include fastcgi.conf; } (注意:FOO是显示$ fastcgi_script_name的日志格式) fastcgi.conf有这一行: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 我希望将$fastcgi_script_name设置为只有bar.php而不是foo/bar.php的url http://example.com/foo/bar.php
传统应用程序通过Slim框架传递所有传统的PHP文件请求到index.php在.htaccess文件。 此外,Symfony应用程序在设置了别名的文件夹中设置。 用PHP-FPM进行VHostconfiguration <VirtualHost *:80> ServerName example.com DocumentRoot /path/to/app/slim Alias /system /path/to/app/symfony <IfModule mpm_itk_module> AssignUserId web_user web_user </IfModule> <LocationMatch "^(.*\.php)$"> ProxyPass fcgi://127.0.0.1:9001/path/to/app/slim </LocationMatch> </VirtualHost> testing文件: /path/to/slim/index.php <?php echo "slim"; /path/to/slim/.htaccess RewriteEngine On RewriteBase / RewriteRule ^hello$ /hello.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] /path/to/slim/hello.php: <?php echo "hello"; /path/to/symfony/app.php <?php echo "symfony"; […]
我不知道如何在Nginx / fastcgi的非根目录下部署一个django站点,比如localhost:8080 / myproject /而不是localhost:8080 /; 我所见过的所有例子都假定Apache或者站点的根目录。 这里是我的nginx.conf的相关部分: server { listen 8080; server_name localhost; location /myproject/ { # host and port to fastcgi server fastcgi_pass 127.0.0.1:3030; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; #fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param […]
我们有一个公司的服务器与各种网站。 他们由我们公司内的不同人员维护。 所有网站都是公开的。 服务器访问仅限于我们公司。 这不是共享主机环境。 我们正在考虑保护服务器,目前正在分析与文件权限有关的风险。 我们觉得上传文件,然后公开打开/执行文件的风险最高。 这不应该发生,但脚本中的错误可能允许人们这样做(有图像上传,file upload等)。 上传器脚本使用PHP。 所以问题是:设置/组织文件和进程权限的最佳方式是什么? 似乎有几个选项来运行PHP(和Apache),并设置权限。 我们应该考虑什么? 有小费吗? 我们正在考虑mod_php和FastCGI,但也许考虑到我们的情况,其他解决scheme是首选?
我得到这个错误: 启动服务:spawn-fcgi:绑定失败:地址已经在使用中 运行这个命令时: /etc/init.d/phpfcgi start 有人可以给我任何想法如何解决它? 这是我的CGI脚本: #!/bin/bash # # Startup script for the PHP FastCGI server. # # chkconfig: 345 85 15 # description: PHP is an HTML-embedded scripting language # processname: php # config: /etc/php.ini # Source function library. . /etc/rc.d/init.d/functions SPAWNFCGI="/usr/bin/spawn-fcgi" PHPFCGI="/usr/bin/php-cgi" FCGIPORT="9000" FCGIADDR="127.0.0.1" PHP_FCGI_CHILDREN=5 PHP_FCGI_MAX_REQUESTS=1000 ALLOWED_ENV="PATH USER" USER=nginx GROUP=nginx #PHPUSER=php PIDFILE=/var/run/phpfcgi.pid […]
在Windows上使用nginx和php-cgi时,出现上述错误。 这是我的nginxconfiguration: worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80 default; server_name localhost; charset utf-8; root ..\www; index index.php index.html index.htm; error_page 500 502 503 504 /50x.html; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; root ..\www; try_files $uri =404; fastcgi_param SCRIPT_FILENAME […]