共计 1236 个字符,预计需要花费 4 分钟才能阅读完成。
记录一下 Linux 环境部署 Tengine2.1.12(Nginx)+PHP5.6.30 过程,以便帮助其他人,至于为什么用 php5.6 而不是 7,感觉老版本稳定。
1. 下载 php5.6.30
2. 编译安装
tar zxf php-x.x.x | |
cd ../php-x.x.x | |
./configure --enable-fpm --with-mysql | |
make | |
make install |
3. 准备运行环境
cd php-x.x.x. 源码路径 | |
cp php.ini-development /usr/local/php/php.ini | |
cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf | |
cp sapi/fpm/php-fpm /usr/local/bin |
4. 修改运行配置
vim /usr/local/php/php.ini | |
#Locate cgi.fix_pathinfo= and modify it as follows: | |
cgi.fix_pathinfo=0 | |
vim /usr/local/etc/php-fpm.conf | |
; Unix user/group of processes | |
; Note: The user is mandatory. If the group is not set, the default user's group | |
; will be used. | |
user = www-data | |
group = www-data |
5. 启动
/usr/local/bin/php-fpm
6.tengine 配置修改
location / { | |
root html; | |
index index.php index.html index.htm; | |
} | |
location ~* \.php$ {fastcgi_index index.php; | |
fastcgi_pass 127.0.0.1:9000; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
} |
7.tengine 启动
sudo /usr/local/nginx/sbin/nginx -s stop | |
sudo /usr/local/nginx/sbin/nginx |
8. 写一个测试文件, 丢在 tengine 的 html 目录里面
rm /usr/local/nginx/html/index.html | |
echo " phpinfo(); " >> /usr/local/nginx/html/index.php |
官网文档,http://php.net/manual/en/install.unix.nginx.php, 这是不主介绍 tengine 的安装, 很简 | |
单的, 参考 tengine 的官网文档即可 |
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-06/144992.htm
正文完
星哥玩云-微信公众号
