我安装的时候装的是php5-dev
装完之后是用phpize5来装自己编写的php扩展
本人转自 http://blog.iyunv.com/zhxp_870516/article/details/8520358
同时也参考了 http://blog.slps.tp.edu.tw/00086/?p=585
下面是我自己的defalut 文件内容 #的是注释 因为有的为了tp整合 支持pathinfo 所以有很多注释没去掉,可以参考上面原作者的default配置 这一段我和原作者不一样
/*
location ~ \.php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
*/
以下是defautl的配置
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name bbb.test.pt;
root /usr/share/nginx/www;
index index.php index.html index.htm;
#index index.php
#1.php
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
# include /etc/nginx/naxsi.rules
}
location /doc/ {
root /usr/share/;
autoindex on;
allow 127.0.0.1;
deny all;
}
# Only for nginx-naxsi : process denied requests
#location /RequestDenied {
# For example, return an error code
#return 418;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
###############################
#去掉$是为了不匹配行末,即可以匹配.php/,以实现pathinfo
#如果你不需要用到php5后缀,也可以将其去掉
# location ~ .php
# {
#原有代码
#定义变量 $path_info ,用于存放pathinfo信息
# set $path_info "";
#定义变量 $real_script_name,用于存放真实地址
# set $real_script_name $fastcgi_script_name;
#如果地址与引号内的正则表达式匹配
# if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
#将文件地址赋值给变量 $real_script_name
# set $real_script_name $1;
#将文件地址后的参数赋值给变量 $path_info
# set $path_info $2;
# }
#配置fastcgi的一些参数
# fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
# fastcgi_param SCRIPT_NAME $real_script_name;
# fastcgi_param PATH_INFO $path_info;
# }
#######
#如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
# if (!-e $request_filename)
# {
#地址作为将参数rewrite到index.php上。
# rewrite ^/(.*)$ /index.php/$1;
#若是子目录则使用下面这句,将subdir改成目录名称即可。
#rewrite ^/subdir/(.*)$ /subdir/index.php/$1;
# }
######
##############################
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
# include /etc/nginx/conf.d/*
}
#include /etc/nginx/conf.d/*;
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# root html;
# index index.html index.htm;
#
# location / {
# try_files $uri $uri/ /index.html;
# }
#}