当前位置:网站首页>Compile and install lamp architecture of WordPress and discuz for multi virtual hosts based on fastcgi mode
Compile and install lamp architecture of WordPress and discuz for multi virtual hosts based on fastcgi mode
2022-06-12 13:49:00 【wwzroom】
Realization CentOS 7 The compilation installation is based on fastcgi Mode of multi virtual host wordpress and discuz Of LAMP framework
1 Experimental framework

2 Environmental preparation
Two hosts :
- A mainframe :httpd+php(fastcgi Pattern )
- A mainframe :mariadb The server
Software version :
- CentOS 7.9
- mariadb-10.2.44-linux-systemd-x86_64.tar.gz General binary format
- apr-1.7.0.tar.bz2
- apr-util-1.6.1.tar.bz2
- httpd-2.4.46.tar.bz2
- php-7.4.29.tar.gz
- wordpress-6.0-zh_CN.tar.gz
- Discuz_X3.4_SC_UTF8_20210926.zip
3 Implementation steps
3.1 Binary installation mariadb
1. Modify hostname
[[email protected]:~]#
hostname mariadb && exit
2. Download the decompression package
[[email protected]:~]#
wget https://mirrors.bkns.vn/mariadb//mariadb-10.2.44/bintar-linux-systemd-x86_64/mariadb-10.2.44-linux-systemd-x86_64.tar.gz
[[email protected]:~]#
tar xvf mariadb-10.2.44-linux-systemd-x86_64.tar.gz -C /usr/local
3. Create a soft connection , Create a new corresponding directory and modify the folder main group
[[email protected]:~]#
cd /usr/local
[[email protected]:/usr/local]#
ln -sv mariadb-10.2.44-linux-systemd-x86_64 mysql
[[email protected]:/usr/local]#
cd /usr/local/mysql
[[email protected]:/usr/local/mysql]#
chown -R root.root /usr/local/mysql/*
[[email protected]:/usr/local/mysql]#
mkdir /data/mysql -p
[[email protected]:/usr/local/mysql]#
chown -R mysql.mysql /data/mysql
4. Copy the configuration file and modify the path
[[email protected]:/usr/local/mysql]#
cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf # new edition mariadb No my-huge.cnf file , Download it yourself
[[email protected]:/usr/local/mysql]#
vim /etc/my.cnf
datadir =/data/mysql
skip_name_resolve = ON
5. Prepare environment variables
[[email protected]:/usr/local/mysql]#
echo 'PATH=/usr/local/mysql/bin/:$PATH' > /etc/profile.d/lamp.sh
[[email protected]:/usr/local/mysql]#
. /etc/profile.d/lamp.sh
6. Install dependency packages
[[email protected]:/usr/local/mysql]#
yum -y install libaio
7. Execute installation script
[[email protected]:/usr/local/mysql]#
/usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysql --user=mysql
8. Set boot up
[[email protected]:/usr/local/mysql]#
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[[email protected]:/usr/local/mysql]#
chkconfig --add mysqld
[[email protected]:/usr/local/mysql]#
systemctl enable --now mysqld
9. start-up MySQL
If you are prompted mysql: error while loading shared libraries: /lib64/libncurses.so.5: file too short Install dependent packages
[[email protected]:/usr/local/mysql]#
yum install ncurses-compat-libs
10. by Wordpress and discuz Applications create databases and accounts
MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create database discuz;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on wordpress.* to [email protected]'10.0.0.%' identified by "wppass";
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> grant all on discuz.* to [email protected]'10.0.0.%' identified by "dispass";
Query OK, 0 rows affected (0.00 sec)
3.2 Compilation and installation httpd 2.4
1. Modify hostname
[[email protected]:~]#
hostname fastcgi && exit
2. Install the dependent package
yum install gcc pcre-devel openssl-devel expat-devel -y
3. Upload and unzip the source package , install lrzsz, Send multiple files directly to the terminal interface
[[email protected]:~]#
tar xvf apr-1.7.0.tar.bz2
[[email protected]:~]#
tar xvf apr-util-1.6.1.tar.bz2
[[email protected]:~]#
tar xvf httpd-2.4.46.tar.bz2
[[email protected]:~]#
mv apr-1.7.0 httpd-2.4.46/srclib/apr
[[email protected]:~]#
mv apr-util-1.6.1 httpd-2.4.46/srclib/apr-util
4. Compilation and installation httpd
[[email protected]:~]#
cd httpd-2.4.46/
[[email protected]:~/httpd-2.4.46]#
./configure \
--prefix=/apps/httpd \
--enable-so \
--enable-ssl \
--enable-cgi \
--enable-rewrite \
--with-zlib \
--with-pcre \
--with-included-apr \
--enable-modules=most \
--enable-mpms-shared=all \
--with-mpm=event
[[email protected]:~/httpd-2.4.46]#
make -j2 && make install
5. Prepare environment variables
[[email protected]:~/httpd-2.4.46]#
echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/httpd.sh
[[email protected]:~/httpd-2.4.46]#
. /etc/profile.d/httpd.sh
6. Create and configure users and groups
[[email protected]:~/httpd-2.4.46]#
sed -ri -e '/^User/c User apache' -e '/^Group/c Group apache' /apps/httpd/conf/httpd.conf
7. modify event Pattern , If it has been specified at compile time that it does not need to be modified , You need to modify the uncompiled specification .
vim /apps/httpd/conf/httpd.conf
LoadModule mpm_event_module modules/mod_mpm_event.so
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
#LoadModule mpm_worker_module modules/mod_mpm_worker.so
8. Set boot up
[[email protected]:~/httpd-2.4.46]#
vim /usr/lib/systemd/system/httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)
[Service]
Type=forking
#EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/apps/httpd/bin/apachectl start
#ExecStart=/apps/httpd/bin/httpd $OPTIONS -k start
ExecReload=/apps/httpd/bin/apachectl graceful
#ExecReload=/apps/httpd/bin/httpd $OPTIONS -k graceful
ExecStop=/apps/httpd/bin/apachectl stop
KillSignal=SIGCONT
PrivateTmp=true
[Install]
WantedBy=multi-user.targe
9. Start the service
[[email protected]:~/httpd-2.4.46]#
apachectl start
3.3 Compilation and installation fastcgi The way of php 7.4
1. Install the dependent package
[[email protected]:~]#
yum -y install gcc libxml2-devel bzip2-devel libmcrypt-devel sqlite-devel oniguruma-devel
2. Decompress and compile
[[email protected]:~]#
wget https://www.php.net/distributions/php-7.4.29.tar.gz
[[email protected]:~]#
tar xvf php-7.4.29.tar.gz
[[email protected]:~]#
cd php-7.4.29
[[email protected]:~]#
./configure \
--prefix=/apps/php \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-openssl \
--with-zlib \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--enable-mbstring \
--enable-xml \
--enable-sockets \
--enable-fpm \
--enable-maintainer-zts \
--disable-fileinfo
[[email protected]:~]#
make -j 2 && make install
3. Prepare environment variables
[[email protected]:~/php-7.4.29]#
echo 'PATH=/apps/php/bin:/apps/httpd/bin:$PATH' > /etc/profile.d/php.sh
[[email protected]:~/php-7.4.29]#
. /etc/profile.d/php.sh
[[email protected]:~/php-7.4.29]#
php --version
PHP 7.4.29 (cli) (built: Jun 10 2022 19:59:37) ( ZTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
4. Get ready php Configuration and startup files for
[[email protected]:~/php-7.4.29]#
cp php.ini-production /etc/php.ini
[[email protected]:~/php-7.4.29]#
cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/
[[email protected]:~/php-7.4.29]#
cd /apps/php/etc
[[email protected]:/apps/php/etc]#
cp php-fpm.conf.default php-fpm.conf
[[email protected]:/apps/php/etc]#
cd php-fpm.d
[[email protected]:/apps/php/etc/php-fpm.d]#
cp www.conf.default www.conf
5. Modify the process owner
[[email protected]:/apps/php/etc/php-fpm.d]#
vim /apps/php/etc/php-fpm.d/www.conf
# Modify the process owner , With Apache Identity running .
user = apache
group = apache
# Support status and ping page
pm.status_path = /fpm_status # uncomment , And modify it fpm_status, Consistent with the virtual host
ping.path = /ping
6. Support opcache Speed up
[[email protected]:/apps/php/etc/php-fpm.d]#
mkdir /etc/php.d/
[[email protected]:/apps/php/etc/php-fpm.d]#
vim /etc/php.d/opcache.ini
[opcache]
zend_extension=opcache.so
opcache.enable=1
7. Start the service ( The module has been compiled , Just add the configuration file )
[[email protected]:/apps/php/etc/php-fpm.d]#
systemctl daemon-reload # Profile validation
[[email protected]:/apps/php/etc/php-fpm.d]#
systemctl enable --now php-fpm.service
3.4 Modify the configuration httpd Support php-fpm
1. Modify the configuration file
[[email protected]:/apps/php/etc/php-fpm.d]#
vim /apps/httpd/conf/httpd.conf
# Uncomment the next two lines , Thus, reverse proxy is supported
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
# add to index For the main page , Add directly to index.html Before
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
# Add the following two lines to the end , Support php Suffix file , Turn on reverse proxy
AddType application/x-httpd-php .php
ProxyRequests Off
# Implement the first virtual machine wordpress,
<virtualhost *:80>
servername blog.magedu.org
documentroot /data/wordpress
<directory /data/wordpress>
require all granted
</directory>
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/data/wordpress/$1
# Realization status and ping page
ProxyPassMatch ^/(fpm_status|ping)$ fcgi://127.0.0.1:9000/$1
CustomLog "logs/access_wordpress_log" common
</virtualhost>
# Implement the second virtual machine discuz
<virtualhost *:80>
servername forum.magedu.org
documentroot /data/discuz
<directory /data/discuz/>
require all granted
</directory>
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/data/discuz/$1
CustomLog "logs/access_discuz_log" common
</virtualhost>
3.5 Get ready wordpress and discuz! Related documents
1. Get ready wordpress file
[[email protected]:~]#
mkdir /data/
[[email protected]:~]#
tar xvf wordpress-6.0-zh_CN.tar.gz
[[email protected]:~]#
mv wordpress/ /data
[[email protected]:~]#
setfacl -R -m u:apache:rwx /data/wordpress/
# perhaps chown –R apache.apache /data/wordpress
2. equipment discuz file
[[email protected]:~]#
unzip Discuz_X3.4_SC_UTF8_20220518.zip
[[email protected]:~]#
mv upload/ /data/discuz
[[email protected]:~]#
setfacl -R -m u:apache:rwx /data/discuz/
3.6 Test access
stay windows in , modify hosts file , Add domain name resolution :
C:\Windows\System32\drivers\etc\hosts
10.0.0.7 forum.magedu.org blog.magedu.org
1.wordpress Test screenshot





2.discuz Test screenshot





边栏推荐
- Web3.0,「激发创造」的时代
- GPUImage链式纹理的简单实现
- 一种快速创建测试窗口的方法
- Factory mode of "object creation" mode
- Django note 21: querying databases using native SQL
- Innovation training (XII) project summary
- 阿里云开发板HaaS510解析串口JSON数据并发送属性
- Convert the string to hexadecimal string and display it
- Codeforces 1629 A. download more RAM - simple greed
- Possible solutions to problems after CodeBlocks installation
猜你喜欢

阿里云开发板HaaS510将串口获取数据发送到物联网平台
![[WUSTCTF2020]颜值成绩查询-1](/img/90/e4c2882357e0a1c6a80f778887e3f5.png)
[WUSTCTF2020]颜值成绩查询-1

【mysql进阶】索引分类及索引优化方案(五)

Behind the unsealing of Shanghai, this group of developers "cloud gathering" built an AI anti epidemic robot

一种快速创建测试窗口的方法
![[wustctf2020] selfie score query -1](/img/dc/47626011333a0e853be87e492d8528.png)
[wustctf2020] selfie score query -1

Realization of Joseph Ring with one-way ring linked list

通过loganalyzer展示数据库中的日志

编译安装基于fastcgi模式的多虚拟主机的wordpress和discuz的LAMP架构

Paw 高级使用指南
随机推荐
[brush title] probability of winning a draw
C language structure
Is MySQL query limit 1000,10 as fast as limit 10? How to crack deep paging
Transmission and response of events and use cases
D1 哪吒开发板 了解基本的启动加载流程
【SemiDrive源码分析】【X9芯片启动流程】26 - R5 SafetyOS 之 LK_INIT_LEVEL_TARGET 阶段代码流程分析(TP Drvier、Audio Server初始化)
Pytorch to onnx, onnxruntime reasoning in mmclas
Alibaba cloud development board haas510 connects to the Internet of things platform -- Haas essay solicitation
List of common ACM knowledge points (to be continued)
Informatics Olympiad all in one 1000: introductory test questions
Application of bit operation in C language
Codeforces 1637 E. best pair - Thinking
Binary tree traversal
Player screen orientation scheme
【mysql进阶】mysql索引数据结构的演变(四)
1002: output the second integer
How to solve the problem of data table query error when SQLite writes the registration function?
C language implementation of string and memory library functions
Introduction to color coding format
Innovation training (XII) project summary