1 环境
主机 | 服务 |
---|---|
node1(192.268.25.145) | httpd, mysql, php |
lamp服务部署顺序
httpd --> mysql --> php
2 部署服务
2.1 安装httpd
- 安装开发工具包
[root@node1 ~]# yum groups mark install 'Development Tools' -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
上次元数据过期检查:0:07:41 前,执行于 2021年09月23日 星期四 02时03分01秒。
依赖关系解决。
==============================================================================
软件包 架构 版本 仓库 大小
==============================================================================
安装组:
Development Tools
事务概要
==============================================================================
完毕!
- 创建apache服务的用户和组
[root@node1 ~]# useradd -r -M -s /sbin/nologin apache
[root@node1 ~]# id apache
uid=975(apache) gid=973(apache) 组=973(apache)
[root@node1 ~]#
- 安装依赖包
[root@node1 ~]# yum -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ make
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
上次元数据过期检查:0:11:00 前,执行于 2021年09月23日 星期四 02时03分01秒。
依赖关系解决。
......
- 下载并解压软件包apr,apr-util,httpd
// 这里是上传的安装包到/usr/src
[root@node1 src]# ls
apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz debug httpd-2.4.48.tar.gz kernels
[root@node1 src]# tar xf apr-1.7.0.tar.gz
[root@node1 src]# tar xf apr-util-1.6.1.tar.gz
[root@node1 src]# tar xf httpd-2.4.48.tar.gz
[root@node1 src]# ls
apr-1.7.0 apr-util-1.6.1 debug httpd-2.4.48.tar.gz
apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.48 kernels
- 编译安装apr
[root@node1 src]# cd apr-1.7.0/
[root@node1 apr-1.7.0]# vim configure
cfgfile="${ofile}T"
trap "$RM \"$cfgfile\"; exit 1" 1 2 15
$RM "$cfgfile" //将此行加上注释,或者删除此行
[root@node1 apr-1.7.0]# ./configure --prefix=/usr/local/apr
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
Configuring APR library
Platform: x86_64-pc-linux-gnu
checking for working mkdir -p... yes
......
[root@node1 apr-1.7.0]# make && make install
make[1]: 进入目录“/usr/src/apr-1.7.0”
/bin/sh /usr/src/apr-1.7.0/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/usr/src/apr-1.7.0/include/arch/unix -I./include/arch/unix -I/usr/src/apr-1.7.0/include/arch/unix -I/usr/src/apr-1.7.0/include -I/usr/src/apr-1.7.0/include/private -I/usr/src/apr-1.7.0/include/private -o encoding/apr_encode.lo -c encoding/apr_encode.c && touch encoding/apr_encode.lo
/usr/src/apr-1.7.0/build/mkdir.sh tools
......
- 编译安装apr-util
[root@node1 src]# cd apr-util-1.6.1/
[root@node1 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
......
[root@node1 apr-util-1.6.1]# make && make install
make[1]: 进入目录“/usr/src/apr-util-1.6.1”
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/src/apr-util-1.6.1/include -I/usr/src/apr-util-1.6.1/include/private -I/usr/local/apr/include/apr-1 -o buckets/apr_brigade.lo -c buckets/apr_brigade.c && touch buckets/apr_brigade.lo
......
- 编译安装httpd
[root@node1 httpd-2.4.48]# ./configure --prefix=/usr/local/apache \
> --enable-so \
> --enable-ssl \
> --enable-cgi \
> --enable-rewrite \
> --with-zlib \
> --with-pcre \
> --with-apr=/usr/local/apr \
> --with-apr-util=/usr/local/apr-util/ \
> --enable-modules=most \
> --enable-mpms-shared=all \
> --with-mpm=prefork
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
......
[root@node1 httpd-2.4.48]# make && make install
编译步骤省略
- 安装后配置
[root@node1 ~]# ls /usr/local/
apache apr-util etc include lib64 sbin src
apr bin games lib libexec share
[root@node1 ~]# ls /usr/local/apache/
bin cgi-bin error icons logs manual
build conf htdocs include man modules
[root@node1 ~]# echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/httpd.sh //配置环境变量
[root@node1 ~]# source /etc/profile.d/httpd.sh
[root@node1 ~]# which httpd
/usr/local/apache/bin/httpd
[root@node1 ~]# ls /usr/local/apache/
bin cgi-bin error icons logs manual
build conf htdocs include man modules
[root@node1 ~]# ln -s /usr/local/apache/include/ /usr/include/httpd
[root@node1 ~]# ll /usr/include/
-rw-r--r--. 1 root root 181 2月 19 2020 gssapi.h
drwxr-xr-x. 2 root root 268 9月 23 02:14 gssrpc
lrwxrwxrwx. 1 root root 26 9月 23 02:50 httpd -> /usr/local/apache/include/
-rw-r--r--. 1 root root 1857 1月 16 2020 iconv.h
[root@node1 ~]# vim /etc/man_db.conf
#MANDATORY_MANPATH /usr/src/pvm3/man
#
MANDATORY_MANPATH /usr/man
MANDATORY_MANPATH /usr/share/man
MANDATORY_MANPATH /usr/local/share/man
MANDATORY_MANPATH /usr/local/apache/man //帮助文档
#---------------------------------------------------------
# set up PATH to MANPATH mapping
- 取消配置文件中ServerName前面的注释
[root@node1 ~]# vim /usr/local/apache/conf/httpd.conf
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName www.example.com:80
#
- 启动httpd
[root@node1 ~]# apachectl start
[root@node1 ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 5 127.0.0.1:631 0.0.0.0:*
LISTEN 0 128 127.0.0.1:6010 0.0.0.0:*
LISTEN 0 128 127.0.0.1:6011 0.0.0.0:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 5 [::1]:631 [::]:*
LISTEN 0 128 [::1]:6010 [::]:*
LISTEN 0 128 [::1]:6011 [::]:*
- 关闭防火墙访问
[root@node1 ~]# systemctl disable --now firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@node1 ~]# setenforce 0
- 编写system服务启动文件
[root@node1 ~]# cat /usr/lib/systemd/system/httpd.service
[Unit]
Description=Httpd server daemon
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start
ExecStop=/usr/local/apache/bin/apachectl stop
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
[root@node1 ~]# systemctl daemon-reload //加载
[root@node1 ]# systemctl enable --now httpd.service
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@node1 system]# systemctl status httpd.service
● httpd.service - Httpd server daemon
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor pres>
Active: active (running) since Thu 2021-09-23 03:18:52 EDT; 1min 26s ago
Main PID: 69204 (httpd)
Tasks: 6 (limit: 11159)
Memory: 4.6M
CGroup: /system.slice/httpd.service
├─69204 /usr/local/apache/bin/httpd -k start
├─69205 /usr/local/apache/bin/httpd -k start
├─69206 /usr/local/apache/bin/httpd -k start
├─69207 /usr/local/apache/bin/httpd -k start
├─69208 /usr/local/apache/bin/httpd -k start
└─69209 /usr/local/apache/bin/httpd -k start
2.2 安装mysql
- 安装依赖包
[root@node1 ]# yum -y install ncurses-devel openssl-devel openssl cmake mariadb-devel
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
......
- 创建用户和组
[root@node1 ~]# useradd -r -M -s /sbin/nologin mysql
- 下载二进制的MySQL包
//这里直接上传的包
[root@node1 ~]# ls /usr/src/
apr-1.7.0 httpd-2.4.48
apr-1.7.0.tar.gz httpd-2.4.48.tar.gz
apr-util-1.6.1 kernels
apr-util-1.6.1.tar.gz mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz
debug
- 解压软件包并安装
[root@node1 src]# tar xf mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@node1 src]# ls /usr/local/
apache bin include libexec share
apr etc lib mysql-5.7.35-linux-glibc2.12-x86_64 src
apr-util games lib64 sbin
[root@node1 local]# ls
apache bin include libexec share
apr etc lib mysql-5.7.35-linux-glibc2.12-x86_64 src
apr-util games lib64 sbin
[root@node1 local]# ln -sv mysql-5.7.35-linux-glibc2.12-x86_64/ mysql
'mysql' -> 'mysql-5.7.35-linux-glibc2.12-x86_64/'
[root@node1 local]# chown -R mysql.mysql /usr/local/mysql
[root@node1 local]# ll /usr/local/mysql
lrwxrwxrwx. 1 mysql mysql 36 9月 23 03:30 /usr/local/mysql -> mysql-5.7.35-linux-glibc2.12-x86_64/
- 添加环境变量
[root@node1 local]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@node1 local]# source /etc/profile.d/mysql.sh
[root@node1 local]# echo $PATH
/usr/local/mysql/bin:/usr/local/apache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
//配置mysql
[root@node1 local]# ln -s /usr/local/mysql/include /usr/include/mysql
[root@node1 local]# vim /etc/man_db.conf
#MANDATORY_MANPATH /usr/src/pvm3/man
#
MANDATORY_MANPATH /usr/man
MANDATORY_MANPATH /usr/share/man
MANDATORY_MANPATH /usr/local/share/man
MANDATORY_MANPATH /usr/local/apache/man
MANDATORY_MANPATH /usr/local/mysql/man
#---------------------------------------------------------
# set up PATH to MANPATH mapping
[root@node1 ~]# cat /etc/ld.so.conf.d/mysql.conf //库文件
/usr/local/mysql/lib
[root@node1 ~]# ldconfig
- 建立数据存放目录
[root@node1 ~]# mkdir -p /opt/data
[root@node1 ~]# chown -R mysql.mysql /opt/data/
[root@node1 ~]# ll /opt/
总用量 0
drwxr-xr-x. 2 mysql mysql 6 9月 23 03:44 data
- 初始化数据库
[root@node1 ~]# /usr/local/mysql/bin/mysqld --initialize-insecure --user mysql --datadir=/opt/data/
2021-09-23T07:47:04.678388Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
......
- 生成配置文件
[root@node1 ~]# cat /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve
- 配置启动服务
[root@node1 ~]# sed -ri 's#^(basedir=).*#\1/usr/local/mysql#g' /usr/local/mysql/support-files/mysql.server
[root@node1 ~]# sed -ri 's#^(datadir=).*#\1/opt/data#g' /usr/local/mysql/support-files/mysql.server
[root@node1 ~]# cat /usr/lib/systemd/system/mysqld.service
[Unit]
Description=Mysql server daemon
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/mysql/support-files/mysql.server start
ExecStop=/usr/local/mysql/support-files/mysql.server stop
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
[root@node1 ~]# systemctl daemon-reload
[root@node1 ~]# systemctl enable --now mysqld.service
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@node1 ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 32 192.168.122.1:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 5 127.0.0.1:631 0.0.0.0:*
LISTEN 0 128 127.0.0.1:6010 0.0.0.0:*
LISTEN 0 128 127.0.0.1:6011 0.0.0.0:*
LISTEN 0 128 127.0.0.1:6012 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
- 登录数据库修改密码
//需先下载此包
[root@node1 ~]# yum -y install ncurses-compat-libs
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
上次元数据过期检查:1:16:55 前,执行于 2021年09月23日 星期四 02时43分46秒。
软件包 ncurses-compat-libs-6.1-7.20180224.el8.i686 已安装。
依赖关系解决。
[root@node1 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.35 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> set password = password("123");
Query OK, 0 rows affected, 1 warning (0.00 sec)
2.3 安装PHP
- 下载PHP wget https://www.php.net/distributions/php-8.0.10.tar.xz
[root@node1 src]# ls
apr-1.7.0 httpd-2.4.48
apr-1.7.0.tar.gz httpd-2.4.48.tar.gz
apr-util-1.6.1 kernels
apr-util-1.6.1.tar.gz mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz
debug php-8.0.10.tar.xz
- 安装依赖包
//先下载epel源
[root@node1 ~]# yum -y install epel-release
//下载依赖包
[root@node1 ~]# yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel openldap-devel pcre-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel mhash mhash-devel
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
......
[root@node1 ~]# yum -y install php-mysqlnd
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
......
[root@node1 ~]# yum -y install libzip-devel.x86_64
上次元数据过期检查:0:02:37 前,执行于 2021年09月23日 星期四 08时56分26秒。
依赖关系解决。
==============================================================================
软件包 架构 版本 仓库 大小
==============================================================================
安装:
libzip-devel x86_64 1.5.1-2.module_el8.2.0+313+b04d0a66 appstream 179 k
......
[root@node1 ~]# yum -y install libsqlite3x-devel
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
......
[root@node1 ~]# yum -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm
上次元数据过期检查:0:04:12 前,执行于 2021年09月23日 星期四 08时56分26秒。
oniguruma-devel-6.8.2-2.el8.x86_64.rpm 23 kB/s | 47 kB 00:02
依赖关系解决。
==============================================================================
软件包 架构 版本 仓库 大小
==============================================================================
安装:
oniguruma-devel x86_64 6.8.2-2.el8 @commandline 47 k
安装依赖关系:
oniguruma x86_64 6.8.2-2.el8 appstream 187 k
事务概要
==============================================================================
安装 2 软件包
......
[root@node1 ~]# yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel openldap-devel pcre-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel mhash mhash-devel
上次元数据过期检查:0:08:33 前,执行于 2021年09月23日 星期四 08时56分26秒。
软件包 libxml2-2.9.7-11.el8.x86_64 已安装。
软件包 libxml2-devel-2.9.7-11.el8.x86_64 已安装。
软件包 openssl-1:1.1.1k-4.el8.x86_64 已安装。
软件包 openssl-devel-1:1.1.1k-4.el8.x86_64 已安装。
......
- 解压
[root@node1 src]# tar xf php-8.0.10.tar.xz
[root@node1 src]# ls
apr-1.7.0 httpd-2.4.48.tar.gz
apr-1.7.0.tar.gz kernels
apr-util-1.6.1 mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz
apr-util-1.6.1.tar.gz php-8.0.10
debug php-8.0.10.tar.xz
httpd-2.4.48
[root@node1 php-8.0.10]#
- 编译安装
[root@node1 php-8.0.10]# ./configure --prefix=/usr/local/php8 \
> --with-config-file-path=/etc \
> --enable-fpm \
> --disable-debug \
> --disable-rpath \
> --enable-shared \
> --enable-soap \
> --with-openssl \
> --enable-bcmath \
> --with-iconv \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-exif \
> --enable-ftp \
> --enable-gd \
> --with-jpeg \
> --with-zlib-dir \
> --with-freetype \
> --with-gettext \
> --enable-mbstring \
> --enable-pdo \
> --with-mysqli=mysqlnd \
> --with-pdo-mysql=mysqlnd \
> --with-readline \
> --enable-shmop \
> --enable-simplexml \
able-sockets \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-pcntl \
--enable-posix> --enable-sockets \
> --with-zip \
> --enable-mysqlnd-compression-support \
> --with-pear \
> --enable-pcntl \
> --enable-posix
编译过程略......
[root@node1 php-8.0.10]# make && make install
/bin/sh /usr/src/php-8.0.10/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/opcache/ -I/usr/src/php-8.0.10/ext/opcache/ -I/usr/src/php-8.0.10/include -I/usr/src/php-8.0.10/main -I/usr/src/php-8.0.10 -I/usr/src/php-8.0.10/ext/date/lib -I/usr/include/libxml2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/src/php-8.0.10/ext/mbstring/libmbfl -I/usr/src/php-8.0.10/ext/mb
......
- 设置环境变量
[root@node1 profile.d]# echo 'export PATH=/usr/local/php8/bin:$PATH' > /etc/profile.d/php.sh
[root@node1 profile.d]# source /etc/profile.d/php.sh
[root@node1 profile.d]# ls
colorgrep.csh colorzgrep.csh lang.csh 'php.sh[root@localhost'
colorgrep.sh colorzgrep.sh lang.sh sh.local
colorls.csh csh.local less.csh vim.csh
colorls.sh gawk.csh less.sh vim.sh
colorxzgrep.csh gawk.sh mysql.sh which2.csh
colorxzgrep.sh httpd.sh php.sh which2.sh
- 配置php-fpm
[root@node1 php-8.0.10]# cp php.ini-production /etc/php.ini
cp:是否覆盖'/etc/php.ini'? y
[root@node1 php-8.0.10]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@node1 php-8.0.10]# chmod +x /etc/init.d/php-fpm
[root@node1 php-8.0.10]# cp /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf
[root@node1 php-8.0.10]# cp /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf
[root@node1 php-8.0.10]#
8.启动php-fpm
[root@node1 php-8.0.10]# cd
[root@node1 ~]# service php-fpm start
Starting php-fpm done
[root@node1 ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 127.0.0.1:9000 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
3 配置apache
在apache httpd 2.4以后已经专门有一个模块针对FastCGI的实现,此模块为mod_proxy_fcgi.so,它其实是作为mod_proxy.so模块的扩展,因此,这两个模块都要加载,编辑httpd.conf文件,取消以下两行内容的注释
[root@node1 php-8.0.10]# vim /usr/local/apache/conf/httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
3.1配置虚拟主机
[root@node1 php-8.0.10]# cd /usr/local/apache/
[root@node1 apache]# ls
bin cgi-bin error icons logs manual
build conf htdocs include man modules
[root@node1 apache]# mkdir htdocs/zhaojie
[root@node1 apache]# vim htdocs/zhaojie/
[root@node1 apache]# vim htdocs/zhaojie
[root@node1 apache]# vim htdocs/zhaojie/index.php
[root@node1 apache]# cat htdocs/zhaojie/index.php
<?php
phpinfo();
?>
[root@node1 apache]# chown -R apache.apache /usr/local/apache/htdocs/
[root@node1 apache]# pwd
/usr/local/apache
[root@node1 apache]# vim conf/httpd.conf
//添加到最后
<VirtualHost *:80>
DocumentRoot "/usr/local/apache/htdocs/zhaojie"
ServerName www.zhaojie.com
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/zhaojie/$1
<Directory "/usr/local/apache/htdocs/zhaojie">
Options none
AllowOverride none
Require all granted
</Directory>
</VirtualHost>
//搜索AddType,添加以下内容
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php 添加此行
AddType application/x-httpd-php-source .phps 添加此行
#
<IfModule dir_module>
DirectoryIndex index.php index.html //添加index.php
</IfModule>
//修改配置文件之后一定要记得重启,否则无效
[root@node1 ~]# systemctl restart httpd
[root@node1 ~]#
4 访问验证