博文

目前显示的是标签为“PHP-FPM”的博文

解决nginx出现File not found的问题

使用php-fpm解析PHP,”No input file specified”,”File not found”是令nginx新手头疼的常见错误,原因是php-fpm进程找不到SCRIPT_FILENAME配置的要执行的.php文件,php-fpm返回给nginx的默认404错误提示。 比如我的网站doucument_root下没有test.php,访问这个文件时通过抓包可以看到返回的内容。   HTTP/1.1 404 Not Found Date: Fri, 21 Dec 2012 08:15:28 GMT Content-Type: text/html Proxy-Connection: close Server: nginx/1.2.5 X-Powered-By: PHP/5.4.7 Via: 1.1 c3300 (NetCache NetApp/6.0.7) Content-Length: 16   File not found.   很多人不想用户直接看到这个默认的404错误信息,想自定义404错误. 给出解决办法前我们来先分析下如何避免出现这类404错误,然后再说真的遇到这种情况(比如用户输入一个错误不存在的路径)时该怎么办,才能显示自定义的404错误页。 一、错误的路径被发送到php-fpm进程 出现这类错误,十个有九个是后端fastcgi进程收到错误路径(SCRIPT_FILENAME),而后端fastcgi收到错误路径的原因大都是配置错误。   常见的nginx.conf的配置如下: server { listen [::]:80; server_name example.com www.example.com; access_log /var/www/logs/example.com.access.log;   location / { root /var/www/example.com; index index.html index.htm index.pl; }   location /images { autoindex on; }   location ~ \.php$ { fastcgi_pass 127.0.0.1:...

Freebsd9.0安装Nginx+PHP-FPM+MySQL+eAccelerator+Memcached+phpMyAdmin

图片
更新 ports 第一种方式: portsnap (自带) 首先修改/etc/portsnap.conf SERVERNAME=portsnap.cn.freebsd.org 1.下载压缩的 Ports 套件快照到 /var/db/portsnap # portsnap fetch 2.假如是首次运行 Portsnap, 则需要将快照释放到 /usr/ports: # portsnap extract 如果您已经有装好的 /usr/ports 而只想更新, 则应执行下面的命令: # portsnap update 完成后需要退出终端重新登陆。 复制cvsup更新配置文件 # cp /usr/share/examples/cvsup/ports-supfile /etc/supfile 下面是我使用的配置,屏蔽了desktop等一些服务器用不到的软件包,源已经改成中国镜像,速度比国外的主服务器要快很多 # $FreeBSD: release/9.0.0/share/examples/cvsup/ports-supfile 219858 2011-03-22 04:31:35Z glebius $ # # This file contains all of the “CVSup collections” that make up the # FreeBSD-current ports collection. # # CVSup (CVS Update Protocol) allows you to download the latest CVS # tree (or any branch of development therefrom) to your system easily # and efficiently (far more so than with sup, which CVSup is aimed # at replacing). If you’re running CVSup interactively, and are # currently using an X display server, you should run CVSup as follows # to keep your CVS tree up-to-date: # # cvsup ...