Articles of FastCGI的

nginx:fastcgi_cache_path为空

我想在我的nginx 1.5.8安装程序上尝试fastcgi_cache ,如下所示。 在nginx conf中,http部分,我补充道: fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=microcache:10m max_size=1000m inactive=60m; 在服务器部分: set $cache_uri $request_uri; # POST requests and urls with a query string should always go to PHP if ($request_method = POST) { set $cache_uri 'null cache'; } if ($query_string != "") { set $cache_uri 'null cache'; } # Don't cache uris containing the […]

将每个请求redirect到FastCGI脚本

我有一个FastCGI脚本,我希望每个请求redirect到它,无论哪个URL。 我目前的虚拟主机configuration如下: <VirtualHost *:80> ServerName localhost FastCGIExternalServer /var/www/localhost/cgi-bin/ws -host 127.0.0.1:2000 Alias / /var/www/localhost/cgi-bin/ws DocumentRoot /var/www/localhost/cgi-bin/ <Directory /var/www/localhost/cgi-bin/> SetHandler fastcgi-script Options +ExecCGI Options +FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> 如果我在浏览器上打开URL http://localhost ,则可以成功查看由CGI脚本呈现的页面。 但是,如果我尝试任何其他页面,我从Apache获得一个错误的404页面,这意味着该请求没有redirect到我的CGI脚本。 我在/var/www/localhost/cgi-bin/添加了下面的.htaccess文件,其中包含以下mod_rewrite规则: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ – [NC,L] RewriteCond […]

PHP-FPM无法创build足够的子项并停止提供服务请求

我是PHP-FPM的新手,我已经注意到随机间隔,它似乎只是locking。 [26-Dec-2014 22:50:16] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 921 total children [26-Dec-2014 22:50:17] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 931 total children [26-Dec-2014 22:50:18] […]

安装nginx&hhvm后无法运行apache

我在我的本地ubuntu机器上运行了Apache2,并在本地安装了nginx&hhvm,以便进行debugging。 我现在想像以前那样切换回Apache2,之前我已经运行了PHP5-FPM的Apache&NGINX,并且可以通过运行下面的代码来切换它们: sudo service nginx stop sudo service apache2 restart 现在,当我尝试访问我的Magento应用程序时,出现以下错误 /var/www/app/Mage.php was not found 我可以看到默认的Ubuntu Apache页面,当我去http:// localhost / 我试过跑步 ~:$ sudo service nginx stop ~:$ sudo service hhvm stop ~:$ sudo service apache2 restart * Restarting web server apache2 [ OK ] ~:$ sudo service php5-fpm restart stop: Unknown instance: php5-fpm start/running, process 12258 […]

如何解决nginx'没有input文件'时的path和权限是好的?

我知道这是一个常见的问题,但我没有发现与我的案例完全匹配的讨论。 nginx错误日志显示: 在stderr中发送FastCGI:“无法打开主脚本:/usr/share/nginx/drupal7/index.php 但: 这条路是正确的,这是我网站的根 www-data有权访问它(如果我做su www-data然后cat /usr/share/nginx/drupal7/index.php文件被显示)。 将nginx的根目录和fpm/pool.d/myserver.conf chroot都指向相同的文件夹: /usr/share/nginx/drupal7 www-data用户和组有660访问这个相同的文件夹到pool.d/myserver.conf ps -u www-data显示它拥有nginx和php5-fpm进程 我没有安装SElinux(有些讨论认为这可能是问题) 那为什么www-data用户可以访问我的index.php而不是FastCGI? 为什么FastCGI尝试正确的path,但是说它不存在?

如何避免与fastcgi_cache的url?

如何避免与fastcgi_cache的url? 不需要caching列表,例如 projectdomain.com/a projectdomain.com/b projectdomain.com/c/d vi /etc/nginx/nginx.conf http { fastcgi_cache_path /var/cache/fastcgi/projectdomain.com levels=1:2 keys_zone=projectdomain.com:10m inactive=5m; add_header X-Fastcgi-Cache $upstream_cache_status; … vi /etc/nginx/conf.d/default.conf map $request_uri $dont_cache_uri { default 0; projectdomain.com/a 1; projectdomain.com/b 1; projectdomain.com/c/d 1; } server { listen 80; server_name projectdomain.com www.projectdomain.com; access_log /var/log/nginx/projectdomain.com.access.log; root /var/www/html/projectdomain.com; index index.php index.html index.htm; try_files $uri $uri/ /index.php?$query_string; client_max_body_size 1G; location […]

有没有办法启用日志文件spawn-fcgi和fcgiwrap?

我正在设置Bugzilla。 我得到了一个403错误。 nginx错误日志文件中没有错误消息。 我很确定403消息是从上游发送的。 我说,因为我可以在nginx错误日志中创build一个403错误,通过搞乱index.cgi文件的安全性。 现在,我在日志中什么都没有。 我怀疑是spawn-fcgi或fcgiwrap的问题是某种访问被拒绝的问题。 有没有办法将设置调整为spawn-fcgi或fcgiwrap,以便它生成日志文件条目? 这是我如何configuration服务。 # more /etc/sysconfig/spawn-fcgi FCGI_SOCKET=/var/run/fcgiwrap.sock FCGI_PROGRAM=/usr/local/sbin/fcgiwrap FCGI_USER=nginx FCGI_GROUP=nginx FCGI_EXTRA_OPTIONS="-M 0700" OPTIONS="-u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -S $FCGI_EXTRA_OPTIONS – F 1 -P /var/run/spawn-fcgi.pid — $FCGI_PROGRAM"

Nginx提供C ++ cgi脚本:响应是二进制格式

我想在nginx上运行C ++ CGI脚本。 我使用nginx网站的脚本使用FCGIWrap。 程序代码是这样的: #include <iostream> using namespace std; int main () { cout << "Content-type:text/html\n\n"; cout << "<html>\n"; cout << "<head>\n"; cout << "<title>Hello World – First CGI Program</title>\n"; cout << "</head>\n"; cout << "<body>\n"; cout << "<h2>Hello World! This is my first CGI program</h2>\n"; cout << "</body>\n"; cout << "</html>\n"; return 0; […]

为什么新的应用程序池标识具有写入权限?

我正在通过FastCGI使用PHP(各种版本)运行IIS 8.5。 模拟在FastCGI的PHPconfiguration中。 应用程序池被设置为使用应用程序池标识。 实际上,如果我实际上拒绝了写入文件的访问权限,那么它的行为是相应的,但是,默认情况下,似乎所有文件都可写入我的网站。 查看有效权限说我的应用程序池标识(IIS AppPool \ PoolName)应该没有任何权限分配。 有一些默认帐户,应用程序池标识inheritance我需要进行调整,以防止写访问默认情况下。 我所读的一切都似乎表明,应用程序池标识应该默认为只读访问应用程序分配的虚拟文件夹,但这与观察到的行为不匹配(具体来说,PHPBB3抱怨configuration文件是可写的,设置写入权限,我可以通过论坛上传文件)。 什么可能会干扰权限,或者是我对预期的默认行为的理解不正确?

Nginx fastcgi_cache排除会话cookie

需要帮助find使用Nginx fastcgi_cache而不cachingPHP会话cookie的正确设置。 这是我目前下面的。 然而,如果我进入一个已经被caching的页面,在浏览器中删除我的PHPSESSION cookie并刷新,那么testing这个,我从一个caching的Nginx文件中得到一个PHPSESSION ID。 if ($http_cookie = "PHPSESSION") { set $fastcgi_skipcache 1; } location ~* \.php { include fastcgi_params; fastcgi_pass backend; fastcgi_index index.php; fastcgi_param SERVER_NAME $host; fastcgi_param SCRIPT_URL $fastcgi_script_name; fastcgi_param SCRIPT_URI $scheme://$http_host$fastcgi_script_name; fastcgi_param SCRIPT_NAME "/index.php"; fastcgi_param PHP_SELF $uri; fastcgi_param HTTPS $https if_not_empty; fastcgi_param HTTP_FRONT_END_HTTPS HTTPS; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param REQUEST_URI $uri?$args; fastcgi_ignore_headers Cache-Control […]