kali nginx php

今天在Kali下配置了Nginx,但是php一直开不起来,妈蛋,搞了好久好久,原来是 php5-frm 没有重启。坑死了。

先安装php-fpm

apt-get install  php5-fpm

然后修改nginx的配置文件:

vim /etc/nginx/sites-available/default

里面php-fpm的默认配置是注释掉的

pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

# #location ~ .php$ {

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;

#}

改成

location ~ \.php$ {
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;
}

即可

然后重启nginx和php-fpm

/etc/init.d/php5-fpm restart

/etc/init.d/nginx restart

一定要重启,否则你的修改是无效的!

comments powered by Disqus