centos7安装tengine配置php-fpm,tenginephp-fpm


centos7安装tengine

官网
github

# 下载
wget http://tengine.taobao.org/download/tengine-2.2.2.tar.gz
tar xvf tengine-2.2.2.tar.gz
cd tengine-2.2.2
# 编译环境
yum -y install gcc gcc-c++ autoconf automake openssl-devel pcre-devel zlib-devel
# 生成配置
./configure \
--prefix=/vhs/tengine \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_concat_module \
--with-pcre \
--with-ipv6
# 一般错误
# nginx: [emerg] invalid port in resolver "fe80::1%eth0" in /vhs/tengine/conf/nginx.conf:126
# 添加--with-ipv6
# nginx: [emerg] invalid IPv6 address in resolver "[fe80::1%eth0]" in /vhs/tengine/conf/nginx.conf:126
# 关闭ipv6地址
nano /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6=1
nano /etc/sysconfig/network
NETWORKING_IPV6=no
# 修改IPV6INIT=no
nano /etc/sysconfig/network-scripts/ifcfg-eth0
# 确认
sysctl -p
# 重启
# 查看ip,已经没有ipv6地址
ip addr
# 再次configure,然后
# 编译安装
make && make install
# 安装目录
cd /vhs/tengine/sbin
# 执行nginx的启动文件
/vhs/tengine/sbin/nginx
# 查看端口80
netstat -ntlp
# 现在可以ip访问
# 配置php-fpm,开启php-fpm服务,端口是9000
/opt/rh/rh-php71/root/sbin/php-fpm
# 查看配置
ps -aux |grep nginx
# 编辑配置
/vhs/tengine/conf/nginx.conf
# 添加index.php
location / {
    root   html;
    index  index.html index.htm index.php;
}
# 取消注释,fastcgi_param修改如下
location ~ \.php$ {
    root           html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    # fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name; # 修改如下
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}
# 测试配置
/vhs/tengine/sbin/nginx -t
# nginx: the configuration file /vhs/tengine/conf/nginx.conf syntax is ok
# nginx: configuration file /vhs/tengine/conf/nginx.conf test is successful
# 重启
/vhs/tengine/sbin/nginx -s reload
# index.php文件
cd /vhs/tengine/html/
mv index.html index.html.bak
nano index.php
<?php
phpinfo();
# 完成之后可以解析php,访问浏览

相关内容

    暂无相关文章