我有一个PHP脚本,做一些数据处理。 脚本完成所有工作所需的时间取决于用户的input。 这是不寻常的,需要5-15分钟的处理。 在Apache上一切正常,但在Nginx的连接刚刚closures。 处理时间很less,一切都很好。 问题来源于长期的要求… 没有任何日志中的错误。 我怀疑浏览器closures了连接。 我嗅探了头文件,Nginx似乎没有发送任何响应,直到处理完成。 没有一个头。 我尝试从脚本发送头文件,但似乎nginxcaching所有。 之后,我禁用了PHP输出缓冲并启用了隐式刷新。 我禁用了gzip压缩和zlib。 我将FAST_CGI_BUFFERS最小化为允许的最小值,即:fastcgi_buffers 2 1k; fastcgi_buffer_size 1k; fastcgi_busy_buffers_size 1k; fastcgi_max_temp_file_size 0; 不过,它拒绝发送标题… 所以只是为了certificate我的情况,在代码中的循环之一,我做了一个var_export的对象之一… 繁荣!!! – 有用… 任何人都可以想到更优雅的解决scheme? 谢谢。 8月19日更新 疯狂的事情正在发生。 在我尝试了两天没有任何运气的情况下进行debugging之后,我尝试了一些我以前应该做的事情。 我在Linode上尝试过这个configuration,它工作! 所以可能这个问题是在Ubuntu的configuration…不知道在哪里看。
新手在这里,所以请温柔:) 我按照ArsTechnica的指南在Ubuntu 10.04上安装了php5-fpm的Nginx: http : //arstechnica.com/information-technology/2012/12/web-served-part-3-bolting-on-php -with-PHP-FPM / Nginx运行起来,它提供静态html罚款。 我遇到了让php5-fpm工作的问题。 我得到一个502坏的网关错误,当我看着它说: connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream 当我回到指南时,它提到configuration/etc/php5/fpm/pool.d/www.conf。 我似乎根本没有一个pool.d目录,也没有名为www.conf的文件。 我在/ etc / php5 / fpm目录下有一些php-fpm.conf文件,它们与指南中介绍的设置相似( listen = /var/run/php5-fpm.soc等)。 我可以使用这个文件,或者在安装php5-fpm时出错了吗?
今天,我重新启动我的服务器和PHP5-FPM由于/var/run/php5-fpm/找不到启动失败。 /var/run/在重新启动时被清除,大多数服务在重新启动时重新创build它们的/var/run/目录。 我总是假设PHP5-FPM在重启时自动创build了/ var / run / php5-fpm /并且之前的重启没有问题。 PHP5-FPM是否停止在更新中创build目录,或者从来没有创build目录? 我今天之前的最后一次重新启动已经超过了30天,而且我不需要手动创build/ var / run / php5-fpm /目录来进行重启。 我是否需要将mkdir添加到我的init.d文件中以获得php5-fpm,或者还有其他build议的方法吗? 另外,为什么这个“目录未find”的错误不会发生之前呢? 其他信息: 服务器运行Debian 7(Wheezy),Nginx和MySQL。 /var/run链接到/run/ 。 /run/具有755的权限,由root拥有。 谢谢。 /etc/init.d/内容中的PHP5-FPM文件 #!/bin/sh ### BEGIN INIT INFO # Provides: php-fpm php5-fpm # Required-Start: $remote_fs $network # Required-Stop: $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 […]
脚本 我有一个网站的结构如下: /index.html /about/index.html /contact/index.php /contact/send_email.php 我本来希望使URL更清洁,所以我会成为等效的结构: / => /index.html /about/ => /about/index.html /contact/ => /contact/index.html /contact/send_email.php => /contact/send_email.php 基本上是一个Nginxconfiguration,从URI中删除所有的index.html或index.php文件名。 我的尝试configuration server { listen 80; root /home/www/mysite; server_name www.mysite.com; location ^~* /[az]+/index\.(html|php)$ { rewrite ^(/[az]+/)index\.(html|php)$ http://www.mysite.com$1? permanent; } try_files $uri $uriindex.html $uriindex.php =404; location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php5.sock fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } […]
/etc/init.d/php-fpm restart Stopping php-fpm: [FAILED] Starting php-fpm: [10-Oct-2013 21:24:37] ERROR: An another FPM instance seems to already listen on /home/php-fpm/sock/gosianozka.sock [10-Oct-2013 21:24:37] ERROR: FPM initialization failed [FAILED] 它不时发生,我不知道如何解决这个问题。 我在CentOS 6.4 64位上从ius repo使用PHP 5.4.20。 PHP 5.4.20 (cli) (built: Sep 20 2013 10:06:51) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies […]
我遇到了nginx + php-fpm提供的Laravel问题,它只是返回一个空白页面。 nginx,php和laravel都没有logging任何错误。 当使用CLI运行index.php时,它将返回欢迎页面。 laravel栈未触及,所有错误报告/显示/日志logging打开。 下面是我的nginx虚拟主机: server { listen 801; server_name _; root /path/to/laravel/public; index index.html index.html index.php; charset utf-8; gzip on; gzip_http_version 1.1; gzip_disable "MSIE [1-6]."; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_comp_level 9; fastcgi_buffers 8 16k; fastcgi_buffer_size 32k; fastcgi_read_timeout 180; # serve static files directly location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { access_log […]
我正在学习本教程 ,尝试在我的LAMP堆栈上安装PHP-FPM。 我在/etc/apache2/sites-available/default包含(根据指南) <IfModule mod_fastcgi.c> Alias /php5.fastcgi /var/www/fastcgi/php5.fastcgi AddHandler php-script .php FastCGIExternalServer /var/www/fastcgi/php5.fastcgi -socket /var/run/php-fpm.sock Action php-script /php5.fastcgi virtual # This part is not necessary to get it to work, but it stops anything else from being # accessed from it by mistake or maliciously. <Directory "/var/www/fastcgi"> Order allow,deny <Files "php5.fastcgi"> Order deny,allow </Files> </Directory> […]
我有2个应用程序在2个不同的文件夹。 我想使用根文件夹除了/ SOMENAME作为URL中的文件夹,在这种情况下,我想指向该文件夹。 我尝试了几个位置/别名块,但没有一个工作(位置是正确的,但PHP文件没有提供只有静态内容)…看到我的configuration下面。 server { listen 80; #disable_symlinks off; server_name join.mydomain.com; #allow few domains root /www/main; #removing the 'index.php' location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php; } index index.html index.php; } location /SOMENAME/ { root /www/somename; } ####################### location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_script_name; […]
我正尝试将一些运行Apache和mod_php的旧版服务器的网站迁移到使用PHP-FPM的Nginx和PHP 7的新服务器上。 这两个网站都在域的根目录下运行一个PHP购物车,并在子文件夹/ news中运行一个wordpress博客。 现在,在旧服务器上,press blog这个词就在一个名为news的文件夹中(因此与购物车文件混合在一起)放在新服务器上,我想将它们分开,以便每个应用程序都可以在其中拥有单独的文件夹,以便: / home / www / sitename / cart / htdocs中的文件位于https://www.site.tld/ 和 / home / www / sitename / wordpress / htdocs中的文件可在https://www.site.tld/news/上find 我还希望能够使用不同的PHP-FPM池来提高安全性,如果需要允许我使用PHP 5池运行任一应用程序,直到它可以更新为在PHP 7上运行。 我已经接近了,但它一直试图从/home/www/sitename/wordpress/htdocs//news/test.php加载/news/test.php而不是/ home / www / manicpanic / wordpress / htdocs / test。 PHP。 configuration: server { listen iphere:443 ssl http2; #ssl conf root /home/www/sitename/cart/htdocs; server_name […]
我试图拒绝访问我们所有的PHP脚本,除了一个IP以外的所有外部世界。 location / { deny all; allow <one-ip-address>; error_page 403 goodpage.php; try_files $uri $uri/ =404; } location ~ \.php$ { deny all; allow <one-ip-address>; include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } location /goodpage.php { allow all; include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } 然而,无论我做什么,我总是最终限制所有* .php或没有。 安装程序是Ubuntu 16.04,Nginx 1.10.0,在此先感谢。