centos7安装lighttpd1.4配置fastcgi

centos7安装lighttpd1.4配置fastcgi

安装

# 下载
wget https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.50.tar.gz
tar xvf lighttpd-1.4.50.tar.gz
cd lighttpd-1.4.50
# 环境
yum -y install gcc gcc-c++ autoconf automake openssl-devel pcre-devel zlib-devel libtool bzip2 bzip2-devel
# 生成配置
./autogen.sh
./configure --prefix=/vhs/lighttpd
make && make install
# 运行
# 把默认配置文件复制到安装目录
mv /home/lighttpd-1.4.50/doc/config /vhs/lighttpd/config/
# 编辑/vhs/lighttpd/config/lighttpd.conf
var.log_root    = "/vhs/lighttpd/log/lighttpd"
var.server_root = "/vhs/lighttpd/www"
var.state_dir   = "/vhs/lighttpd/run"
var.home_dir    = "/vhs/lighttpd/lib/lighttpd"
var.conf_dir    = "/vhs/lighttpd/etc/lighttpd"
# 创建文件夹

mkdir -p /vhs/lighttpd/log/lighttpd
mkdir -p /vhs/lighttpd/www
mkdir -p /vhs/lighttpd/www/htdocs
mkdir -p /vhs/lighttpd/run
mkdir -p /vhs/lighttpd/lib/lighttpd
mkdir -p /vhs/lighttpd/lib/lighttpd/sockets
mkdir -p /vhs/lighttpd/etc/lighttpd

# (network.c.167) warning: please use server.use-ipv6 only for hostnames, not without server.bind / empty address; your config will break if the kernel default for IPV6_V6ONLY changes 
# 将配置文件lighttpd.conf中的server.use-ipv6 设为 "disable" 或者直接注释
# (server.c.1258) can't find groupname lighttpd
# 将配置文件lighttpd.conf中的groupname和username直接注释
# server.username  = "lighttpd"
# server.groupname = "lighttpd"
# 修改modules.conf 约130的FastCGI (mod_fastcgi)
# 取消注释符号
include "conf.d/fastcgi.conf"
# 对应修改conf.d/fastcgi.conf, 从 22行到52行,取消注释符号 “#”,同时正确设置 php-cgi 的路径(/opt/rh/rh-php71/root/bin/php-cgi)
fastcgi.server = ( ".php" =>
                   ( "php-local" =>
                     (
                       "socket" => socket_dir + "/php-fastcgi-1.socket",
                       "bin-path" => "/opt/rh/rh-php71/root/bin/php-cgi",
                       "max-procs" => 1,
                       "broken-scriptfilename" => "enable",
                     )
                   ),
                   ( "php-tcp" =>
                     (
                       "host" => "127.0.0.1",
                       "port" => 9999,
                       "check-local" => "disable",
                       "broken-scriptfilename" => "enable",
                     )
                   ),

                   ( "php-num-procs" =>
                     (
                       "socket" => socket_dir + "/php-fastcgi-2.socket",
                       "bin-path" => "/opt/rh/rh-php71/root/bin/php-cgi",
                       "bin-environment" => (
                         "PHP_FCGI_CHILDREN" => "16",
                         "PHP_FCGI_MAX_REQUESTS" => "10000",
                       ),
                       "max-procs" => 5,
                       "broken-scriptfilename" => "enable",
                     )
                   ),
                )
# 设置php.ini的cgi.fix_pathinfo = 1
cgi.fix_pathinfo = 1
# 开启 lighttpd
/vhs/lighttpd/sbin/lighttpd -f /vhs/lighttpd/config/lighttpd.conf
# 如果出现启动失败,参看错误日志
# daemonized server failed to start; check error log for details
cat /vhs/lighttpd/log/lighttpd/error.log 

你可能感兴趣的:(lighttpd,centos)