显示标签为“Centos 8”的博文。显示所有博文
显示标签为“Centos 8”的博文。显示所有博文

2021年1月3日星期日

Centos8 Apache + Php7.4 安装脚本

#Set ssh cli dir color 

cat /etc/DIR_COLORS | sed 's/01;34/01;36/' > ~/.dir_colors


#rpm for centos 8

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

yum -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm


dnf -y install dnf-utils

dnf module install php:remi-7.4  -y

 

dnf install php php-cli php-common -y


yum update -y

yum groupinstall "Development Tools" -y

yum install ncurses-devel -y

yum install wget telnet -y

yum install -y libxslt libxslt-devel libxml2 libxml2-devel libicu-devel

yum -y install expect

yum install ImageMagick -y

yum install ImageMagick-devel -y

yum -y install mysql mysql-devel

yum -y install php-mysql php-pear php-xml php-cli php-imap php-gd php-pdo php-devel php-mbstring php-common php-ldap php php-imagick

yum -y install libmcrypt libmcrypt-devel readline-devel php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-curl php-memcache  php-sockets php-ioncube-loader php-bcmath

yum -y install httpd httpd-manual httpd-devel 

yum -y install mod_ssl mod_perl mod_fcgid  mod_php


# Set apache module 

sed -i '/mod_mpm_prefork/ c LoadModule mpm_prefork_module modules/mod_mpm_prefork.so' /etc/httpd/conf.modules.d/*-mpm.conf

sed -i '/mod_mpm_event/ c #LoadModule mpm_event_module modules/mod_mpm_event.so' /etc/httpd/conf.modules.d/*-mpm.conf


#Selinux

sed -i 's/enforcing/disabled/g' /etc/selinux/config

setenforce 0


#Service Config

systemctl start httpd.service

systemctl enable httpd.service


systemctl start firewalld

systemctl enable firewalld.service


#Firewall Rule

firewall-cmd --permanent --zone=public --add-service=http

firewall-cmd --permanent --zone=public --add-service=https

firewall-cmd --permanent --add-port=443/tcp

firewall-cmd --permanent --add-port=80/tcp

firewall-cmd --reload


#Set Httpd.conf

sed -i 's/AllowOverride None/AllowOverride All/g' /etc/httpd/conf/httpd.conf 

if [ ! -d /etc/httpd/conf.d/vhost/ ];then

mkdir /etc/httpd/conf.d/vhost/ -p

echo 'IncludeOptional conf.d/vhost/*.conf' >> /etc/httpd/conf/httpd.conf

echo 'SetEnvIf Ssl-Offloaded 1 HTTPS=on' >> /etc/httpd/conf/httpd.conf

echo 'SetEnvIf Server-Https SSL HTTPS=on' >> /etc/httpd/conf/httpd.conf

echo 'SetEnvIf X-Forwarded-Proto https HTTPS=on' >> /etc/httpd/conf/httpd.conf

fi


systemctl restart httpd.service


echo 'Install OK'


============================== 

Save as ./centos-8-apache-php-install.sh

sh centos-8-apache-php-install.sh 

Apache mod_fcgid - fcgid.conf 设置

#Add php-wrapper $ vi /var/www/cgi-bin/php-wrapper #!/bin/sh PHPRC="/var/www/cgi-bin/php.ini" export PHPRC PHP_FCGI_CHILDREN=4 PHP...