有了前面学习的知识的铺垫,今天可以来学习下第一个常用的web架构了。
所谓lamp,其实就是由Linux+Apache+Mysql/MariaDB+Php/Perl/Python的一组动态网站或者服务器的开源软件,除Linux外其它各部件本身都是各自独立的程序,但是因为经常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台。
LAMP指的是Linux(操作系统)、Apache(HTTP服务器)、MySQL(也指MariaDB,数据库软件)和PHP(有时也是指Perl或Python)的第一个字母,一般用来建立web应用平台。
在说lamp架构平台的搭建前,我们先来了解下什么是CGI,什么是FastCGI,什么是......
web服务器的资源分为两种,静态资源和动态资源
那么web服务器如何执行程序并将结果返回给客户端呢?下面通过一张图来说明一下web服务器如何处理客户端的请求
如上图所示
阶段①显示的是httpd服务器(即apache)和php服务器通过FastCGI协议进行通信,且php作为独立的服务进程运行
阶段②显示的是php程序和mysql数据库间通过mysql协议进行通信。php与mysql本没有什么联系,但是由Php语言写成的程序可以与mysql进行数据交互。同理perl和python写的程序也可以与mysql数据库进行交互
上图阶段①中提到了FastCGI,下面我们来了解下CGI与FastCGI。
CGI(Common Gateway Interface,通用网关接口),CGI是外部应用程序(CGI程序)与WEB服务器之间的接口标准,是在CGI程序和Web服务器之间传递信息的过程。CGI规范允许Web服务器执行外部程序,并将它们的输出发送给Web浏览器,CGI将web的一组简单的静态超媒体文档变成一个完整的新的交互式媒体。
FastCGI(Fast Common Gateway Interface)是CGI的改良版,CGI是通过启用一个解释器进程来处理每个请求,耗时且耗资源,而FastCGI则是通过master-worker形式来处理每个请求,即启动一个master主进程,然后根据配置启动几个worker进程,当请求进来时,master会从worker进程中选择一个去处理请求,这样就避免了重复的生成和杀死进程带来的频繁cpu上下文切换而导致耗时
httpd与php结合的方式有以下三种:
较于CGI方式,FastCGI更为常用,很少有人使用CGI方式来加载动态资源
通过上面的图说明一下web的工作流程:
环境说明:
系统平台 |
IP |
需要安装的服务 |
centos7 |
172.16.12.128 |
httpd-2.4 |
lamp平台软件安装次序:
httpd --> mysql --> php
注意:php要求httpd使用prefork MPM
Index of /apr
https://downloads.apache.org/apr/apr-1.7.0.tar.gz
https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz
Index of /httpd
https://downloads.apache.org/httpd/httpd-2.4.54.tar.gz
//YUM源配置
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Stream-AppStream.repo CentOS-Stream-Extras.repo CentOS-Stream-PowerTools.repo
CentOS-Stream-BaseOS.repo CentOS-Stream-HighAvailability.repo CentOS-Stream-RealTime.repo
CentOS-Stream-Debuginfo.repo CentOS-Stream-Media.repo
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# ls
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
--2022-08-02 20:03:43-- https://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 223.76.170.224, 223.76.171.231, 223.76.170.225, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|223.76.170.224|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’
/etc/yum.repos.d/CentOS-Base 100%[============================================>] 2.46K --.-KB/s in 0s
2022-08-02 20:03:45 (19.2 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]
[root@localhost yum.repos.d]# ls
CentOS-Base.repo
[root@localhost yum.repos.d]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# yum makecache
CentOS-8.5.2111 - Base - mirrors.aliyun.com 907 kB/s | 4.6 MB 00:05
CentOS-8.5.2111 - Extras - mirrors.aliyun.com 84 kB/s | 10 kB 00:00
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com 2.3 MB/s | 8.4 MB 00:03
Metadata cache created.
[root@localhost yum.repos.d]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
Last metadata expiration check: 0:00:27 ago on Tue 02 Aug 2022 08:12:26 PM CST.
epel-release-latest-8.noarch.rpm 31 kB/s | 24 kB 00:00
Dependencies resolved.
[root@localhost yum.repos.d]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
[root@localhost yum.repos.d]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# yum makecache
CentOS-8.5.2111 - Base - mirrors.aliyun.com 24 kB/s | 3.9 kB 00:00
CentOS-8.5.2111 - Extras - mirrors.aliyun.com 6.3 kB/s | 1.5 kB 00:00
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com 11 kB/s | 4.3 kB 00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64 400 kB/s | 1.0 MB 00:02
Extra Packages for Enterprise Linux 8 - x86_64 2.1 MB/s | 13 MB 00:05
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Metadata cache created.
[root@localhost yum.repos.d]#
//安装开发工具包
[root@localhost ~]# yum groups mark install 'Development Tools'
//创建apache服务的用户和组
[root@localhost ~]# groupadd -r apache
[root@localhost ~]# useradd -r -M -s /sbin/nologin -g apache apache
//安装依赖包
[root@localhost ~]# yum -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ make
Last metadata expiration check: 0:05:49 ago on Tue 02 Aug 2022 08:14:43 PM CST.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Package libtool-2.4.6-25.el8.x86_64 is already installed.
Package gcc-8.4.1-1.el8.x86_64 is already installed.
Package gcc-c++-8.4.1-1.el8.x86_64 is already installed.
Package make-1:4.2.1-10.el8.x86_64 is already installed.
Dependencies resolved.
//下载和安装apr以及apr-util
[root@localhost ~]# wget https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz
[root@localhost ~]# wget https://downloads.apache.org/apr/apr-1.7.0.tar.gz
[root@localhost ~]# ls
anaconda-ks.cfg apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz
[root@localhost ~]# wget https://downloads.apache.org/httpd/httpd-2.4.54.tar.gz
[root@localhost ~]# ls
anaconda-ks.cfg apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz
[root@localhost ~]#
[root@localhost ~]# tar xf apr-1.7.0.tar.gz
[root@localhost ~]# tar xf apr-util-1.6.1.tar.gz
[root@localhost ~]# ls
anaconda-ks.cfg apr-1.7.0 apr-1.7.0.tar.gz apr-util-1.6.1 apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz
[root@localhost ~]#
[root@localhost ~]# cd apr-1.7.0/
[root@localhost apr-1.7.0]# vim configure
cfgfile=${ofile}T
trap "$RM \"$cfgfile\"; exit 1" 1 2 15
#$RM "$cfgfile" //将此行加上注释,或者删除此行
cat <<_LT_EOF >> "$cfgfile"
#! $SHELL
[root@localhost apr-1.7.0]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.7.0]# make && make install
[root@localhost apr-1.7.0]# cd
[root@localhost ~]# cd apr-util-1.6.1/
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# make && make install
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
apr apr-util bin etc games include lib lib64 libexec sbin share src
//编译安装httpd
[root@localhost ~]# ls
anaconda-ks.cfg apr-1.7.0 apr-1.7.0.tar.gz apr-util-1.6.1 apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz
[root@localhost ~]# tar xf httpd-2.4.54.tar.gz
[root@localhost ~]# cd httpd-2.4.54/
[root@localhost httpd-2.4.54]#
[root@localhost httpd-2.4.54]# ./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
[root@localhost httpd-2.4.54]# make && make install
//安装后配置
[root@localhost ~]# echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/httpd.sh
[root@localhost ~]# source /etc/pro
profile profile.d/ protocols
[root@localhost ~]# source /etc/profile.d/httpd.sh
[root@localhost ~]# which httpd
/usr/local/apache/bin/httpd
[root@localhost ~]#
[root@localhost ~]# ln -s /usr/local/apache/include/ /usr/include/httpd
[root@localhost ~]# vim /etc/man_db.conf
MANDATORY_MANPATH /usr/man
MANDATORY_MANPATH /usr/share/man
MANDATORY_MANPATH /usr/local/share/man
MANDATORY_MANPATH /usr/local/apache/man //添加文档
//取消ServerName前面的注释
[root@localhost ~]# sed -i '/#ServerName/s/#//g' /etc/httpd24/httpd.conf
//启动apache
[root@localhost ~]# cd /usr/lib/systemd/system
[root@localhost system]# cp sshd.service httpd.service
[root@localhost system]# vim httpd.service
[root@localhost system]# cat httpd.service
[Unit]
Description=wed server daemon
Documentation=man:sshd(5)
After=network.target sshd-keygen.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@localhost system]#
[root@localhost system]#
[root@localhost system]# systemctl daemon-reload
[root@localhost system]#
[root@localhost system]# systemctl start httpd.service
[root@localhost system]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
[root@localhost system]#
MySQL :: Download MySQL Community Server (Archived Versions)
https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
//安装依赖包
[root@localhost ~]# yum -y install ncurses-devel openssl-devel openssl cmake mariadb-devel
//创建用户和组
[root@localhost ~]# useradd -r -M -s /sbin/nologin mysql
//下载二进制格式的mysql软件包
https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
[root@localhost ~]# ls
1 apr-1.7.0.tar.gz httpd-2.4.54
anaconda-ks.cfg apr-util-1.6.1 httpd-2.4.54.tar.gz
apr-1.7.0 apr-util-1.6.1.tar.gz mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
[root@localhost ~]#
//解压软件至/usr/local/
[root@localhost ~]# tar xf mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
apache apr-util etc include lib64 mysql-5.7.38-linux-glibc2.12-x86_64 share
apr bin games lib libexec sbin src
[root@localhost local]# mv mysql-5.7.38-linux-glibc2.12-x86_64 mysql
[root@localhost local]# ls
apache apr apr-util bin etc games include lib lib64 libexec mysql sbin share src
[root@localhost local]#
//修改目录/usr/local/mysql的属主属组
[root@localhost local]# chown -R mysql.mysql /usr/local/mysql
[root@localhost local]# ll /usr/loc
al/mysql -d
drwxr-xr-x. 9 mysql mysql 129 Aug 2 21:38 /usr/local/mysql
[root@localhost local]#
[root@localhost local]#
//添加环境变量
[root@localhost local]# cd /usr/local/mysql/
[root@localhost mysql]#
[root@localhost mysql]# ls
bin docs include lib LICENSE man README share support-files
[root@localhost mysql]#
[root@localhost ~]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@localhost ~]# source /etc/profile.d/mysql.sh
//配置mysql
[root@localhost mysql]# ln -s /usr/local/mysql/include/ /usr/include/mysql
[root@localhost mysql]# echo '/usr/local/mysql/lib/' > /etc/ld.so.conf.d/mysql.conf
[root@localhost mysql]# vim /etc/man_db.conf
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
//建立数据存放目录
[root@localhost ~]# mkdir /opt/data
[root@localhost ~]# chown -R mysql.mysql /opt/data/
[root@localhost ~]# ll /opt/
total 0
drwxr-xr-x. 2 mysql mysql 6 Aug 2 21:54 data
[root@localhost ~]#
//初始化数据库
[root@localhost ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/opt/data/
2022-08-02T13:56:54.733420Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-08-02T13:56:55.179642Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-08-02T13:56:55.244458Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-08-02T13:56:55.249665Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: f7dac5a1-126a-11ed-963c-000c29c3451c.
2022-08-02T13:56:55.250525Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-08-02T13:56:55.747223Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-08-02T13:56:55.747252Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-08-02T13:56:55.747766Z 0 [Warning] CA certificate ca.pem is self signed.
2022-08-02T13:56:55.766842Z 1 [Note] A temporary password is generated for root@localhost: oTgwHgZSV9)f
//请注意,这个命令的最后会生成一个临时密码,此处密码是jtBzkkb=r5ik
//再次注意,这个密码是随机的,你的不会跟我一样,一定要记住这个密码,因为一会登录时会用到
[root@localhost ~]# echo 'oTgwHgZSV9)f' > 123
//生成配置文件
[root@localhost ~]# vim /etc/my.cnf
[root@localhost ~]# rpm -qa | grep mariadb
mariadb-devel-10.3.28-1.module_el8.3.0+757+d382997d.x86_64
mariadb-connector-c-devel-3.1.11-2.el8_3.x86_64
mariadb-connector-c-config-3.1.11-2.el8_3.noarch
mariadb-connector-c-3.1.11-2.el8_3.x86_64
[root@localhost ~]# dnf -y remove mariadb*
[root@localhost ~]# vim /etc/my.cnf
[root@localhost ~]# 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@localhost ~]# cd /usr/local/mysql/
[root@localhost mysql]# ls
bin docs include lib LICENSE man README share support-files
[root@localhost mysql]# cd support-files/
[root@localhost support-files]# ls
magic mysqld_multi.server mysql-log-rotate mysql.server
[root@localhost support-files]# file mysql.server
mysql.server: POSIX shell script, ASCII text executable
[root@localhost support-files]# cp mysql.server /etc/init.d/mysqld
[root@localhost support-files]# vim /etc/init.d/mysqld
# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.
basedir=/usr/local/mysql //数据库装在那
datadir=/opt/data //数据在那
# Default value, in seconds, afterwhich the script should timeout waiting
# for server start.
[root@localhost support-files]#
[root@localhost support-files]# chmod +x /etc/init.d/mysqld //给它执行权限
[root@localhost support-files]# cd
[root@localhost ~]#
[root@localhost ~]# service mysqld start
Starting MySQL.Logging to '/opt/data/localhost.localdomain.err'.
SUCCESS!
[root@localhost ~]#
[root@localhost ~]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
[root@localhost ~]#
//设置开机自启
[root@localhost ~]# chkconfig --add mysqld
[root@localhost ~]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost ~]#
//关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
[root@localhost ~]#
//修改数据库密码
[root@localhost ~]# mysql -uroot -p'oTgwHgZSV9)f'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.38
Copyright (c) 2000, 2022, 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('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> exit
Bye
//出现的报错情况
[root@localhost ~]# mysql -uroot -p'oTgwHgZSV9)f'
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
[root@localhost ~]# yum provides libncurses.so.5
Last metadata expiration check: 2:05:27 ago on Tue 02 Aug 2022 08:14:43 PM CST.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
ncurses-compat-libs-6.1-9.20180224.el8.i686 : Ncurses compatibility libraries
Repo : base
Matched from:
Provide : libncurses.so.5
[root@localhost ~]#
[root@localhost ~]# yum -y install ncurses-compat-libs
Last metadata expiration check: 2:06:39 ago on Tue 02 Aug 2022 08:14:43 PM CST.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Dependencies resolved.
PHP: Hypertext Preprocessor
PHP: Downloads
https://www.php.net/distributions/php-7.4.30.tar.xz
//下载编译的依赖
[root@wxh ~]# dnf -y install libsqlite3x-devel libzip-devel http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm
//配置yum源
//安装依赖包
[root@localhost ~]# yum list all | grep php |grep mysql 新版本已更新
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
#php-mysqlnd.x86_64 7.2.24-1.module_el8.2.0+313+b04d0a66 AppStream
[root@localhost ~]#
[root@localhost ~]# 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 php-mysqlnd
//可查看yum安装的版本
[root@localhost ~]# yum list all | grep php
//下载php
[root@localhost ~]# wget https://www.php.net/distributions/php-7.4.30.tar.xz
--2022-08-02 22:31:07-- https://www.php.net/distributions/php-7.4.30.tar.xz
Resolving www.php.net (www.php.net)... 185.85.0.29, 2a02:cb40:200::1ad
Connecting to www.php.net (www.php.net)|185.85.0.29|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10419136 (9.9M) [application/octet-stream]
Saving to: ‘php-7.4.30.tar.xz’
php-7.4.30.tar.xz 100%[===================================>] 9.94M 2.58MB/s in 5.0s
2022-08-02 22:31:13 (1.99 MB/s) - ‘php-7.4.30.tar.xz’ saved [10419136/10419136]
[root@localhost ~]# ls
1 apr-1.7.0 apr-util-1.6.1.tar.gz mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
123 apr-1.7.0.tar.gz httpd-2.4.54 php-7.4.30.tar.xz
anaconda-ks.cfg apr-util-1.6.1 httpd-2.4.54.tar.gz
[root@localhost ~]# sha256sum php-7.4.30.tar.xz
ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d php-7.4.30.tar.xz
[root@localhost ~]#
//编译安装php
[root@localhost php-7.4.30]#./configure --prefix=/usr/local/php7 \
--with-config-file-path=/etc \
--enable-fpm \
--enable-inline-optimization \
--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-json \
--enable-mbstring \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-readline \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-pcntl \
--enable-posix
[root@localhost php-7.4.30]# make
[root@localhost php-7.4.30]# make install
//安装后配置
[root@localhost ~]# echo 'export PATH=/usr/local/php7/bin:$PATH' > /etc/profile.d/php7.sh
[root@localhost ~]# source /etc/profile.d/php7.sh
[root@localhost ~]# which php
/usr/local/php7/bin/php
[root@localhost ~]#
[root@localhost ~]# php -v
PHP 7.4.30 (cli) (built: Aug 2 2022 23:35:07) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
[root@localhost ~]#
[root@localhost ~]#
//配置php-fpm
[root@localhost ~]# cd php-7.4.30/
[root@localhost php-7.4.30]#
[root@localhost php-7.4.30]# cp php.ini-production /etc/php.ini
cp: overwrite '/etc/php.ini'? y
[root@localhost php-7.4.30]# ls
appveyor config.status libtool php.ini-development TSRM
azure configure LICENSE php.ini-production UPGRADING
azure-pipelines.yml configure.ac main README.md UPGRADING.INTERNALS
build CONTRIBUTING.md Makefile README.REDIST.BINS win32
buildconf docs Makefile.fragments run-tests.php Zend
buildconf.bat ext Makefile.objects sapi
CODING_STANDARDS.md EXTENSIONS modules scripts
config.log include NEWS tests
config.nice libs pear travis
[root@localhost php-7.4.30]# cd sapi/
[root@localhost sapi]# ls
apache2handler cgi cli embed fpm litespeed phpdbg
[root@localhost sapi]# cd fpm/
[root@localhost fpm]# ls
config.m4 init.d.php-fpm.in php-fpm.8 php-fpm.service tests
CREDITS LICENSE php-fpm.8.in php-fpm.service.in www.conf
fpm Makefile.frag php-fpm.conf status.html www.conf.in
init.d.php-fpm php-fpm php-fpm.conf.in status.html.in
[root@localhost fpm]# ls
config.m4 init.d.php-fpm.in php-fpm.8 php-fpm.service tests
CREDITS LICENSE php-fpm.8.in php-fpm.service.in www.conf
fpm Makefile.frag php-fpm.conf status.html www.conf.in
init.d.php-fpm php-fpm php-fpm.conf.in status.html.in
[root@localhost fpm]# file init.d.php-fpm
init.d.php-fpm: POSIX shell script, ASCII text executable
[root@localhost fpm]# cp init.d.php-fpm /etc/init.d/php-fpm
[root@localhost fpm]# chmod +x /etc/init.d/php-fpm
[root@localhost fpm]# cd
[root@localhost ~]#
[root@localhost ~]# cd php-7.4.30/
[root@localhost php-7.4.30]#
[root@localhost php-7.4.30]# cp php.ini-production /etc/php.ini
cp: overwrite '/etc/php.ini'? y
[root@localhost php-7.4.30]# ls
appveyor config.status libtool php.ini-development TSRM
azure configure LICENSE php.ini-production UPGRADING
azure-pipelines.yml configure.ac main README.md UPGRADING.INTERNALS
build CONTRIBUTING.md Makefile README.REDIST.BINS win32
buildconf docs Makefile.fragments run-tests.php Zend
buildconf.bat ext Makefile.objects sapi
CODING_STANDARDS.md EXTENSIONS modules scripts
config.log include NEWS tests
config.nice libs pear travis
[root@localhost php-7.4.30]# cd sapi/
[root@localhost sapi]# ls
apache2handler cgi cli embed fpm litespeed phpdbg
[root@localhost sapi]# cd fpm/
[root@localhost fpm]# ls
config.m4 init.d.php-fpm.in php-fpm.8 php-fpm.service tests
CREDITS LICENSE php-fpm.8.in php-fpm.service.in www.conf
fpm Makefile.frag php-fpm.conf status.html www.conf.in
init.d.php-fpm php-fpm php-fpm.conf.in status.html.in
[root@localhost fpm]# ls
config.m4 init.d.php-fpm.in php-fpm.8 php-fpm.service tests
CREDITS LICENSE php-fpm.8.in php-fpm.service.in www.conf
fpm Makefile.frag php-fpm.conf status.html www.conf.in
init.d.php-fpm php-fpm php-fpm.conf.in status.html.in
[root@localhost fpm]# file init.d.php-fpm
init.d.php-fpm: POSIX shell script, ASCII text executable
[root@localhost fpm]# cp init.d.php-fpm /etc/init.d/php-fpm
[root@localhost fpm]# chmod +x /etc/init.d/php-fpm
[root@localhost fpm]# cd
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# cd /usr/local/php7/
[root@localhost php7]# ls
bin etc include lib php sbin var
[root@localhost php7]# cd etc/
[root@localhost etc]# ls
pear.conf php-fpm.conf.default php-fpm.d
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# ls
pear.conf php-fpm.conf php-fpm.conf.default php-fpm.d
[root@localhost etc]#
[root@localhost etc]# cd php-fpm.d/
[root@localhost php-fpm.d]# ls
www.conf.default
[root@localhost php-fpm.d]# cp www.conf.default www.conf
[root@localhost php-fpm.d]# ls
www.conf www.conf.default
[root@localhost php-fpm.d]#
[root@localhost php-fpm.d]#
[root@localhost php-fpm.d]# service php-fpm start
Starting php-fpm done
[root@localhost php-fpm.d]# ss -anlt
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 [::]:*
//设置开机自启
[root@localhost php-fpm.d]#
[root@localhost php-fpm.d]# chkconfig --add php-fpm
[root@localhost php-fpm.d]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
php-fpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost php-fpm.d]#
[root@localhost php-fpm.d]#
[root@localhost php-fpm.d]# cd
[root@localhost ~]#
[root@localhost ~]#
//每个版本都有可能出现的问题
[root@localhost ~]# tar xf php-7.4.30.tar.xz
[root@localhost ~]# cd php-7.4.30/
[root@localhost php-7.4.30]#
[root@localhost php-7.4.30]# ./configure --prefix=/usr/local/php7 \
> --with-config-file-path=/etc \
> --enable-fpm \
> --enable-inline-optimization \
> --disable-debug \
> --disable-rpath \
> --enable-shared \
> --enable-soap \
> --with-openssl \
> --enable-bcmath \
> --with-iconv \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-exif \
> --enable-ftp \
> --with-gd \
> --with-jpeg-dir \
> --with-png-dir \
> --with-zlib-dir \
> --with-freetype-dir \
> --with-gettext \
> --enable-json \
> --enable-mbstring \
> --enable-pdo \
> --with-mysqli=mysqlnd \
> --with-pdo-mysql=mysqlnd \
> --with-readline \
> --enable-shmop \
> --enable-simplexml \
> --enable-sockets \
> --enable-zip \
> --enable-mysqlnd-compression-support \
> --with-pear \
> --enable-pcntl \
> --enable-posix
Package 'sqlite3', required by 'virtual:world', not found
[root@localhost ~]# yum list all | grep sqlite3
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
libsqlite3x.x86_64 20071018-26.el8 epel
libsqlite3x-devel.x86_64 20071018-26.el8 epel
preludedb-sqlite3.x86_64 5.2.0-1.el8 epel
rubygem-sqlite3.x86_64 1.4.2-2.el8 epel
rubygem-sqlite3-doc.noarch 1.4.2-2.el8 epel
soci-sqlite3.x86_64 4.0.0-2.el8 epel
soci-sqlite3-devel.x86_64 4.0.0-2.el8 epel
uwsgi-plugin-sqlite3.x86_64 2.0.20-1.el8 epel
zabbix-dbfiles-sqlite3.noarch 6.0.2-1.module_el8+14182+e1fc92db epel-modular
zabbix-proxy-sqlite3.x86_64 6.0.2-1.module_el8+14182+e1fc92db epel-modular
zabbix40-dbfiles-sqlite3.noarch 4.0.39-1.el8 epel
zabbix40-proxy-sqlite3.x86_64 4.0.39-1.el8 epel
[root@localhost ~]#
[root@localhost ~]# yum -y install libsqlite3x-devel
[root@localhost php-7.4.30]# ./configure --prefix=/usr/local/php7 \
> --with-config-file-path=/etc \
> --enable-fpm \
> --enable-inline-optimization \
> --disable-debug \
> --disable-rpath \
> --enable-shared \
> --enable-soap \
> --with-openssl \
> --enable-bcmath \
> --with-iconv \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-exif \
> --enable-ftp \
> --with-gd \
> --with-jpeg-dir \
> --with-png-dir \
> --with-zlib-dir \
> --with-freetype-dir \
> --with-gettext \
> --enable-json \
> --enable-mbstring \
> --enable-pdo \
> --with-mysqli=mysqlnd \
> --with-pdo-mysql=mysqlnd \
> --with-readline \
> --enable-shmop \
> --enable-simplexml \
> --enable-sockets \
> --enable-zip \
> --enable-mysqlnd-compression-support \
> --with-pear \
> --enable-pcntl \
> --enable-posix
Package 'oniguruma', required by 'virtual:world', not found
https://pkgs.org/
https://centos.pkgs.org/8-stream/centos-powertools-x86_64/oniguruma-devel-6.8.2-2.el8.x86_64.rpm.html
http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm
[root@localhost ~]# dnf -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm
[root@localhost php-7.4.30]# ./configure --prefix=/usr/local/php7 \
> --with-config-file-path=/etc \
> --enable-fpm \
> --enable-inline-optimization \
> --disable-debug \
> --disable-rpath \
> --enable-shared \
> --enable-soap \
> --with-openssl \
> --enable-bcmath \
> --with-iconv \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-exif \
> --enable-ftp \
> --with-gd \
> --with-jpeg-dir \
> --with-png-dir \
> --with-zlib-dir \
> --with-freetype-dir \
> --with-gettext \
> --enable-json \
> --enable-mbstring \
> --enable-pdo \
> --with-mysqli=mysqlnd \
> --with-pdo-mysql=mysqlnd \
> --with-readline \
> --enable-shmop \
> --enable-simplexml \
> --enable-sockets \
> --enable-zip \
> --enable-mysqlnd-compression-support \
> --with-pear \
> --enable-pcntl \
> --enable-posix
configure: WARNING: unrecognized options: --with-gd, --with-jpeg-dir, --with-png-dir, --with-freetype-dir, --enable-zip
[root@localhost ~]# cd php-7.4.30/
[root@localhost php-7.4.30]# ./configure --help | grep dg
[root@localhost php-7.4.30]#
[root@localhost php-7.4.30]#
[root@localhost php-7.4.30]# ./configure --help | grep gd
--with-gdbm[=DIR] DBA: GDBM support
--enable-gd Include GD support
--with-external-gd Use external libgd
--with-webp GD: Enable WEBP support (only for bundled libgd)
--with-jpeg GD: Enable JPEG support (only for bundled libgd)
--with-xpm GD: Enable XPM support (only for bundled libgd)
libgd)
--enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support (only
for bundled libgd)
[root@localhost php-7.4.30]# ./configure --help | grep jpeg
--with-jpeg GD: Enable JPEG support (only for bundled libgd)
[root@localhost php-7.4.30]# ./configure --help | grep png
[root@localhost php-7.4.30]#
没有参数之间删除
[root@localhost php-7.4.30]# ./configure --help | grep freetype
--with-freetype GD: Enable FreeType 2 support (only for bundled
[root@localhost php-7.4.30]#
[root@localhost php-7.4.30]# ./configure --help | grep zip
--with-zip Include Zip read/write support
[root@localhost php-7.4.30]#
[root@localhost php-7.4.30]#./configure --prefix=/usr/local/php7 \
--with-config-file-path=/etc \
--enable-fpm \
--enable-inline-optimization \
--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-json \
--enable-mbstring \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-readline \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-pcntl \
--enable-posix
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
Package 'libzip', required by 'virtual:world', not found
Package 'libzip', required by 'virtual:world', not found
Package 'libzip', required by 'virtual:world', not found
[root@localhost ~]# yum list all | grep zip | grep lib
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
bzip2-libs.i686 1.0.6-26.el8 @base
bzip2-libs.x86_64 1.0.6-26.el8 @anaconda
libzip.x86_64 1.5.1-2.module_el8.2.0+313+b04d0a66 AppStream
libzip-devel.x86_64 1.5.1-2.module_el8.2.0+313+b04d0a66 AppStream
libzip-tools.x86_64 1.5.1-2.module_el8.2.0+313+b04d0a66 AppStream
zziplib.i686 0.13.68-9.el8 AppStream
zziplib.x86_64 0.13.68-9.el8 AppStream
zziplib-utils.x86_64 0.13.68-9.el8 AppStream
[root@localhost ~]# yum -y install libzip-devel
3.4.1 启用代理模块
在apache httpd 2.4以后已经专门有一个模块针对FastCGI的实现,此模块为mod_proxy_fcgi.so,它其实是作为mod_proxy.so模块的扩展,因此,这两个模块都要加载,编辑httpd.conf文件,取消以下两行内容的注释:
[root@localhost ~]# cd /usr/local/apache/conf/
[root@localhost conf]# ls
extra httpd.conf magic mime.types original
[root@localhost conf]# vim httpd.conf
#LoadModule remoteip_module modules/mod_remoteip.so
LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
//启用httpd的相关模块
[root@localhost ~]# sed -i '/proxy_module/s/#//g' /etc/httpd24/httpd.conf
[root@localhost ~]# sed -i '/proxy_fcgi_module/s/#//g' /etc/httpd24/httpd.conf
3.4.2 配置虚拟主机
在需要使用fcgi的虚拟主机中添加类似如下两行:
ProxyRequests Off //关闭正向代理
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/PATH/TO/DOCUMENT_ROOT/$1
例如:
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/idfsoft.com/$1
以上设置表示把以.php结尾的文件请求发送到php-fpm进程,php-fpm至少需要知道运行的目录和URI,所以这里直接在fcgi://127.0.0.1:9000后指明了这两个参数,其它参数的传递已经被mod_proxy_fcgi.so进行了封装,不需要手动指定。
注意:
这里写的/var/www/html/是yum源安装方式生成的网页存放目录,这里必须改成你编译安装指定的网页存放路径,禁止直接复制我这里的路径
这里的idfsoft.com是域名,你必须改成你所使用的域名,禁止直接复制此处的域名
这里的$1表示匹配所有以.php结尾的http请求
//创建虚拟主机目录并生成php测试页面
[root@localhost ~]# cd /usr/local/apache/conf/
[root@localhost conf]# ls
extra httpd.conf magic mime.types original
[root@localhost conf]#
[root@localhost conf]#
[root@localhost conf]#
[root@localhost conf]# ls /usr/local/apache/
bin build cgi-bin conf error htdocs icons include logs man manual modules
[root@localhost conf]# ls /usr/local/apache/htdocs/
index.html
[root@localhost conf]# mkdir -p /usr/local/apache/htdocs/runtime
[root@localhost conf]# vim /usr/local/apache/htdocs/runtime/index.php
[root@localhost conf]#
~
[root@localhost conf]# chown -R apache.apache /usr/local/apache/htdocs/
[root@localhost conf]# ll /usr/local/apache/htdocs/ -d
drwxr-xr-x. 3 apache apache 39 Aug 3 22:08 /usr/local/apache/htdocs/
[root@localhost conf]# ls
extra httpd.conf magic mime.types original
[root@localhost conf]# cd extra/
[root@localhost extra]# ls
httpd-autoindex.conf httpd-info.conf httpd-mpm.conf httpd-userdir.conf
httpd-dav.conf httpd-languages.conf httpd-multilang-errordoc.conf httpd-vhosts.conf
httpd-default.conf httpd-manual.conf httpd-ssl.conf proxy-html.conf
[root@localhost extra]#
[root@localhost extra]# vim httpd-vhosts.conf
//在配置文件的最后加入以下内容
DocumentRoot "/usr/local/apache/htdocs/runtime"
ServerName runtime.example.com
ErrorLog "logs/runtime.example.com-error_log"
CustomLog "logs/runtime.example.com-access_log" common
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/runtime/$1
Options none
AllowOverride none
Require all granted
[root@localhost extra]# cd ..
[root@localhost conf]# ls
extra httpd.conf magic mime.types original
[root@localhost conf]# vim httpd.conf
//搜索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 #添加此行
#Include conf/extra/httpd-info.conf
//搜索vhosts
# Virtual hosts
Include conf/extra/httpd-vhosts.conf #取消注释
# Local access to the Apache HTTP Server Manual
//搜索index.html
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
DirectoryIndex index.php #默认访问这个页面 index.html
//重启apache服务
[root@localhost conf]# systemctl restart httpd.service
[root@localhost conf]# systemctl status httpd.service
● httpd.service - wed server daemon
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2022-08-03 22:34:35 CST; 18s ago
Docs: man:sshd(5)
Process: 236428 ExecStop=/usr/local/apache/bin/apachectl stop (code=exited, status=0/SUCCESS)
Process: 236432 ExecStart=/usr/local/apache/bin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 236437 (httpd)
Tasks: 6 (limit: 11200)
Memory: 6.1M
CGroup: /system.slice/httpd.service
├─236437 /usr/local/apache/bin/httpd -k start
├─236438 /usr/local/apache/bin/httpd -k start
├─236439 /usr/local/apache/bin/httpd -k start
├─236440 /usr/local/apache/bin/httpd -k start
├─236441 /usr/local/apache/bin/httpd -k start
└─236442 /usr/local/apache/bin/httpd -k start
[root@localhost conf]#
//关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl status firewalld.service
[root@localhost ~]# vim /etc/selinux/config
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
phpMyAdmin
phpMyAdmin 是众多 MySQL图形化管理工具中使用最为广泛的一种,是一款使用PHP 开发的基于B/S模式的 MySQL 客户端软件,该工具是基于 Web 跨平台的管理程序,并且支持简体中文,用户可以在官网上下载最新版本的。
phpMyAdmin 为Web 开发人员提供了类似 Access,SQL Server 的图形化数据库操作界面,通过该管理工具可以对 MySQL 进行各种操作,如何创建数据库,数据表和生成 MySQL 数据库脚本文件等。
功能特点
PHP是一个基于服务端来创建动态网站的脚本语言,您可以用PHP和HTML生成网站主页。当一个访问者打开主页时,服务端便执行PHP的命令并将执行结果发送至访问者的浏览器中,这类似于ASP和CoildFusion,然而PHP和他们不同之处在于PHP开放源码和跨越平台,PHP可以运行在WINDOWSNT和多种版本的UNIX上。它不需要任何预先处理而快速反馈结果,它也不需要mod_perl的调整来使您的服务器的内存映象减小。PHP消耗的资源较少,当PHP作为ApacheWeb服务器一部分时,运行代码不需要调用外部二进制程序,服务器不需要承担任何额外的负担。
除了能够操作您的页面外,PHP还能发送HIIP的标题。您可以设置cookie,管理数字签名和重定向用户,而且它提供了极好的连通性到其它数据库(还有ODBC),集成各种外部库来做用PDF文档解析XML的任何事情。[1]
phpMyAdmin 是一个用PHP编写的软件工具,可以通过web方式控制和操作MySQL数据库。通过phpMyAdmin 可以完全对数据库进行操作,例如建立、复制和删除数据等等。如果使用合适的工具,MySQL数据库的管理就会变得相当简单。应用 MySQL 命令行方式需要对 MySQL 知识非常熟悉,对SQL语言也是同样的道理。不仅如此,如果数据库的访问量很大,列表中数据的读取就会相当困难。
当前出现很多GUI MySQL客户程序,其中最为出色的是基于 Web 的phpMyAdmin 工具。这是一种 MySQL数据库前台的基于PHP的工具。
PhpMyAdmin 的缺点是必须安装在 Web 服务器中,所以如果没有合适的访问权限,其它用户有可能损害到 SQL 数据。
phpMyAdmin 图形化管理工具的可视化界面中操作数据库
在官网下载phpMyAdmin 的包
————————————————
版权声明:本文为CSDN博主「lang212」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_56774628/article/details/126132233
phpMyAdmin安装部署
提前下载好安装包
[root@localhost ~]# cd /usr/local/apache/htdocs/
[root@localhost htdocs]# ls
index.html phpMyAdmin phpMyAdmin-5.2.0-all-languages.zip runtime
[root@localhost htdocs]#
[root@localhost htdocs]# cd
[root@localhost ~]# cd /usr/local/apache/conf/
[root@localhost conf]# ls
! extra httpd.conf magic mime.types original
[root@localhost conf]# cd extra/
[root@localhost extra]# ls
httpd-autoindex.conf httpd-info.conf httpd-mpm.conf httpd-userdir.conf
httpd-dav.conf httpd-languages.conf httpd-multilang-errordoc.conf httpd-vhosts.conf
httpd-default.conf httpd-manual.conf httpd-ssl.conf proxy-html.conf
[root@localhost extra]# vim httpd-vhosts.conf
[root@localhost extra]#
[root@localhost extra]# systemctl restart httpd.service
[root@localhost extra]#
DocumentRoot "/usr/local/apache/htdocs/phpMyAdmin"
ServerName phpMyAdmin.example.com
ErrorLog "logs/phpMyAdmin.example.com-error_log"
CustomLog "logs/phpMyAdmin.example.com-access_log" common
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/phpMyAdmin/$1
Options none
AllowOverride none
Require all granted