编译实现基于FASTCGI的LAMP的wordpress

准备环境,两台主机,100做httpd+php,150做mariadb
1、将安装包rz到主机:[root@100 ~]#ls
httpd-2.4.37.tar.bz2 apr-1.6.5.tar.bz2 mariadb-10.2.15-linux-x86_64.tar.gz apr-util-1.6.1.tar.bz2 php-7.3.2.tar.xz wordpress-5.0-zh_CN.zip
[root@100 ~]#tar xf apr-1.6.5.tar.bz2
[root@100 ~]#tar xf httpd-2.4.37.tar.bz2
[root@100 ~]#tar xf php-7.3.2.tar.xz
[root@100 ~]#tar xf apr-util-1.6.1.tar.bz2
2、100主机上:mv apr-1.6.5 httpd-2.4.37/srclib/apr
mv apr-util-1.6.1 httpd-2.4.37/srclib/apr-util
3、一、cd httpd-2.4.37/
二、yum install gcc glibc pcre-devel openssl-devel expat-devel libxml2-devel bzip2-devel libmcrypt-devel
三、./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork --with-included-apr
四、make -j 4 && make install
4、[root@100 httpd-2.4.37]#echo ‘PATH=/app/httpd24/bin:$PATH‘ > /etc/profile.d/lamp.sh
[root@100 httpd-2.4.37]#. /etc/profile.d/lamp.sh
5、useradd -r -s /sbin/nologin apache
[root@centos7 httpd-2.4.37]#vim /app/httpd24/conf/httpd.conf 此项修改不是必须,主要为了方便查看
User apache
Group apache
6、[root@100 httpd-2.4.37]#apachectl
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using 0.0.0.100. Set the ‘ServerName‘ directive globally to suppress this message
[root@100 httpd-2.4.37]#ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :::80 :::*
7、现在我们去centos6上测试:[root@centos6 ~]#curl 192.168.141.100
<html><body><h1>It works!</h1></body></html> 此时说明Apache已经安装成功。
8、150主机上:tar xvf mariadb-10.2.15-linux-x86_64.tar.gz -C /usr/local/
[root@centos7 ~]#cd /usr/local
[root@centos7 local]#ls
bin games lib libexec sbin src
etc include lib64 mariadb-10.2.15-linux-x86_64 share
[root@centos7 local]#ln -s mariadb-10.2.15-linux-x86_64/ mysql
[root@centos7 local]#chown -R root.root /usr/local/mysql/
[root@centos7 local]#ls
bin games lib libexec mysql share etc include lib64 mariadb-10.2.15-linux-x86_64 sbin src
[root@centos7 local]#cd mysql/
[root@centos7 mysql]#ls
bin data lib README-wsrep support-files
COPYING EXCEPTIONS-CLIENT man scripts
COPYING.thirdparty include mysql-test share
CREDITS INSTALL-BINARY README.md sql-bench
[root@centos7 mysql]#mkdir /etc/mysql/
[root@centos7 mysql]#cp support-files/my-huge.cnf /etc/mysql/my.cnf
9、[root@centos7 mysql]#vim /etc/mysql/my.cnf
[mysqld]
datadir=/data/mysql
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
10、[root@centos7 mysql]#chown mysql.mysql /data/mysql
[root@centos7 mysql]#ll /data/mysql
total 0
[root@centos7 mysql]#ls
bin data lib README-wsrep support-files
COPYING EXCEPTIONS-CLIENT man scripts
COPYING.thirdparty include mysql-test share
CREDITS INSTALL-BINARY README.md sql-bench
[root@centos7 mysql]#scripts/mysql_install_db --datadir=/data/mysql --user=mysql
Installing MariaDB/MySQL system tables in ‘/data/mysql‘ ...
2019-03-04 17:09:17 140578725427008 [Warning] ‘THREAD_CONCURRENCY‘ is deprecated and will be removed in a future release.
2019-03-04 17:09:17 140578724841216 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1146: Table ‘mysql.gtid_slave_pos‘ doesn‘t exist
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
‘./bin/mysqladmin‘ -u root password ‘new-password‘
‘./bin/mysqladmin‘ -u root -h centos7.localdomain password ‘new-password‘
Alternatively you can run:
‘./bin/mysql_secure_installation‘
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.
You can start the MariaDB daemon with:
cd ‘.‘ ; ./bin/mysqld_safe --datadir=‘/data/mysql‘
You can test the MariaDB daemon with mysql-test-run.pl
cd ‘./mysql-test‘ ; perl mysql-test-run.pl
Please report any problems at http://mariadb.org/jira
The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB‘s strong and vibrant community:
https://mariadb.org/get-involved/
[root@centos7 mysql]#ls -l /data/mysql/
total 110660
-rw-rw----. 1 mysql mysql 16384 Mar 4 17:09 aria_log.00000001
-rw-rw----. 1 mysql mysql 52 Mar 4 17:09 aria_log_control
-rw-rw----. 1 mysql mysql 938 Mar 4 17:09 ib_buffer_pool
-rw-rw----. 1 mysql mysql 12582912 Mar 4 17:09 ibdata1
-rw-rw----. 1 mysql mysql 50331648 Mar 4 17:09 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 Mar 4 17:09 ib_logfile1
drwx------. 2 mysql root 4096 Mar 4 17:09 mysql
-rw-rw----. 1 mysql mysql 29009 Mar 4 17:09 mysql-bin.000001
-rw-rw----. 1 mysql mysql 19 Mar 4 17:09 mysql-bin.index
-rw-rw----. 1 mysql mysql 7 Mar 4 17:09 mysql-bin.state
drwx------. 2 mysql mysql 20 Mar 4 17:09 performance_schema
drwx------. 2 mysql root 6 Mar 4 17:09 test
11、[root@centos7 mysql]#cp support-files/mysql.server /etc/init.d/mysqld
[root@centos7 mysql]#ll /etc/init.d/mysqld
-rwxr-xr-x. 1 root root 12273 Mar 4 17:12 /etc/init.d/mysqld
[root@centos7 mysql]#chkconfig --add mysqld
ch[root@centos7 mysql]#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 三个文件已正常可使用
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@centos7 mysql]#service mysqld start
Starting mysqld (via systemctl): [ OK ]
12、[root@centos7 mysql]#echo ‘PATH=/usr/local/mysql/bin:$PATH‘ > /etc/profile.d/mysql.sh
[root@centos7 mysql]#. /etc/profile.d/mysql.sh
[root@centos7 mysql]#mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.2.15-MariaDB-log MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> create database wpdb;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> grant all on wpdb.* to wpuser@‘192.168.141.%‘ identified by ‘123gxy‘;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit

13、[root@centos7 data]#unzip wordpress-5.0-zh_CN.zip
[root@centos7 data]#ls
mysql php-7.3.2 wordpress wordpress-5.0-zh_CN.zip
[root@centos7 data]#cp -R wordpress /app/httpd24/htdocs/
[root@centos7 data]#cd wordpress/
[root@centos7 wordpress]#ls
index.php wp-blog-header.php wp-includes wp-settings.php
license.txt wp-comments-post.php wp-links-opml.php wp-signup.php
readme.html wp-config-sample.php wp-load.php wp-trackback.php
wp-activate.php wp-content wp-login.php xmlrpc.php
wp-admin wp-cron.php wp-mail.php
[root@centos7 wordpress]#cp wp-config-sample.php wp-config.php
[root@centos7 wordpress]#vim wp-config.php
// MySQL 设置 - 具体信息来自您正在使用的主机 //
/* WordPress数据库的名称 /
define(‘DB_NAME‘, ‘wpdb‘);

/* MySQL数据库用户名 /
define(‘DB_USER‘, ‘wpuser‘);

/* MySQL数据库密码 /
define(‘DB_PASSWORD‘, ‘123gxy‘);

/* MySQL主机 /
define(‘DB_HOST‘, ‘192.168.141.150‘);
14、[root@centos7 ~]#vim /app/httpd24/conf/httpd.conf 把该文件下的2行取消注释,激活
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
ProxyRequests Off
ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/app/httpd24/htdocs/$1 这四行加入
[root@centos7 htdocs]#apachectl restart

15、我们配置php[root@centos7 wordpress]#cd /data/php-7.3.2/
[root@centos7 php-7.3.2]#cp php.ini-production /etc/php.ini
[root@centos7 php-7.3.2]#chmod +x /etc/init.d/php-fpm
[root@centos7 php-7.3.2]#chkconfig --add php-fpm
[root@centos7 php-7.3.2]#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
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 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
16、[root@centos7 php-7.3.2]#ls /app/php/
bin etc include lib php sbin var 这是编译好的文件
[root@centos7 php-7.3.2]#cd /app/php/etc
[root@centos7 etc]#ls
pear.conf php-fpm.conf.default php-fpm.d
[root@centos7 etc]#cp php-fpm.conf.default php-fpm.conf
[root@centos7 etc]#cp php-fpm.d/www.conf.default php-fpm.d/www.conf
启动服务:[root@centos7 etc]#service php-fpm start
Starting php-fpm done
[root@centos7 etc]#ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.1:9000 :
现在我们去访问页面:
13、[root@centos7 data]#unzip wordpress-5.0-zh_CN.zip
[root@centos7 data]#ls
mysql php-7.3.2 wordpress wordpress-5.0-zh_CN.zip
[root@centos7 data]#cp -R wordpress /app/httpd24/htdocs/
[root@centos7 data]#cd wordpress/
[root@centos7 wordpress]#ls
index.php wp-blog-header.php wp-includes wp-settings.php
license.txt wp-comments-post.php wp-links-opml.php wp-signup.php
readme.html wp-config-sample.php wp-load.php wp-trackback.php
wp-activate.php wp-content wp-login.php xmlrpc.php
wp-admin wp-cron.php wp-mail.php
[root@centos7 wordpress]#cp wp-config-sample.php wp-config.php
[root@centos7 wordpress]#vim wp-config.php
// MySQL 设置 - 具体信息来自您正在使用的主机 //
/* WordPress数据库的名称 /
define(‘DB_NAME‘, ‘wpdb‘);

/* MySQL数据库用户名 /
define(‘DB_USER‘, ‘wpuser‘);

/* MySQL数据库密码 /
define(‘DB_PASSWORD‘, ‘123gxy‘);

/* MySQL主机 /
define(‘DB_HOST‘, ‘192.168.141.150‘);
14、[root@centos7 ~]#vim /app/httpd24/conf/httpd.conf 把该文件下的2行取消注释,激活
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
ProxyRequests Off
ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/app/httpd24/htdocs/$1 这四行加入
[root@centos7 htdocs]#apachectl restart

15、我们配置php[root@centos7 wordpress]#cd /data/php-7.3.2/
[root@centos7 php-7.3.2]#cp php.ini-production /etc/php.ini
[root@centos7 php-7.3.2]#chmod +x /etc/init.d/php-fpm
[root@centos7 php-7.3.2]#chkconfig --add php-fpm
[root@centos7 php-7.3.2]#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
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 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
16、[root@centos7 php-7.3.2]#ls /app/php/
bin etc include lib php sbin var 这是编译好的文件
[root@centos7 php-7.3.2]#cd /app/php/etc
[root@centos7 etc]#ls
pear.conf php-fpm.conf.default php-fpm.d
[root@centos7 etc]#cp php-fpm.conf.default php-fpm.conf
[root@centos7 etc]#cp php-fpm.d/www.conf.default php-fpm.d/www.conf
启动服务:[root@centos7 etc]#service php-fpm start
Starting php-fpm done
[root@centos7 etc]#ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.1:9000 :
现在我们去访问页面:

原文地址:https://blog.51cto.com/14128387/2357994

时间: 2024-10-20 10:18:05

编译实现基于FASTCGI的LAMP的wordpress的相关文章

LAMP ----- 编译实现基于FASTCGI的LAMP的WordPress

1 准备环境,两台主机: 一台: httpd, php 192.168.21.104 安装包存放路径: /data apr-1.6.5.tar.bz2 httpd.apache.org #wget http://mirror.bit.edu.cn/apache//apr/apr-1.6.5.tar.bz2 apr-util-1.6.1.tar.bz2 httpd.apache.org #wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.

CentOS 7 &nbsp; 基于fastcgi 的lamp

实验环境  CentOS 7, lamp (php-fpm) 要求:(1) 三者分离于三台主机: (2) 一个虚拟主机用于提供phpMyAdmin:另一个虚拟主机用于提供wordpress: (3) xcache 规划  172.18.105.110 上运行http服务器 172.18.250.157 运行数据库 172.18.253.26 运行php-fpm程序 我提前做好了DNS 两台A记录172.18.105.110 对应的FQDN 为www1.stu05.com  www2.stu05.

基于fastcgi部署Lamp

部署要求:(1)CentOS 7 httpd,php-fpm,mariadb三者分离于三台主机: web主机:192.168.11.101 部署httpd服务: fcgi主机:192.168.11.227 部署php-fpm服务: mariadb主机:192.168.11.241 部署mariadb服务: (2)一个虚拟主机用于提供phpMyAdmin:另一个虚拟主机用于提供wordpress: 部署过程: 一.为各主机安装相关服务并启动服务,此处为yum安装. 1.在web主机上安装httpd

生产环境LAMP搭建 - 基于 fastcgi

生产环境LAMP搭建 - 基于 fastcgi 由于在module模式,php只是已http的模块形式存在,无形中加重了http的服务负载,通常在企业架构中,使用fastcgi的模式,将所有的服务都设置为不同的独立服务,独立进程的形式存在,并部署在不同的设备上.是用的比较多的. php 进程 默认使用9000端口 默认 php-fpm 只监听127.0.0.1 的 9000 端口 配置php的连接方式,有静态和动态两种模式 pm = static|dynamic static:固定数量的子进程:

部署环境:基于fastcgi的主机服务分离的LAMP

一.FastCgi与PHP-fpm 参考: http://www.mike.org.cn/articles/what-is-cgi-fastcgi-php-fpm-spawn-fcgi/ 二.LAMP分离架构 资源规划: 静态层:172.16.1.1,httpd服务器 动态层:172.16.1.2,PHP服务器,启动php-fpm 数据层:172.16.1.3, mysql服务器,lvm 三.数据库服务器搭建 略,参考上一篇:部署环境:LAMP+Xcache 四.httpd服务器的搭建 略,参考

基于NDS+NFS+LAMP搭建discuz论坛

本节我们来看看如何基于一个DNS+NFS+LAMP平台来搭建一个discuz论坛.由于DNS以及LAMP前面几节中的我们以及讲过,所以这边我们就简单以相关配置为主,至于编译安装请参看前面几节的内容.好了,话不多说,下面我们就开始吧. 实验环境拓扑:两台web服务器,共享关系型数据库,共享NFS服务器,利用DNS记录轮询提供负载均衡. 这边解释一下: DNS服务器以及2个Apache服务器我都放在同一台机器上以虚拟主机的形式实现. 如下图: DNS服务器的配置 直接安装: [[email prot

漫漫运维路——基于fpm的LAMP平台的构建

构建LAMP平台,可以把PHP编译为apache的一个模块或者直接把PHP编译为一个单独的服务,然后独立运行,当apache需要和PHP通信时,apache就变为了一个客户端,向PHP发起请求,然后由PHP把apache发去的代码解释后发回apache,最后由apache返回给客户端. 要编译实现fpm模式的LAMP平台,可以使用两台或者三台虚拟机,分别在虚拟机上编译出apache和PHP和MariaDB,在此我使用两台虚拟机.一台独立运行MariaDB,另一台运行apache和PHP.规划如下

Ansible roles实现LAMP部署wordpress

ansible lamp ansible roles实现lamp安装wordpress 整个role目录的结构: .├── ansible.cfg├── hosts├── httpd-php_roles.retry├── httpd-php_roles.yml├── roles│   ├── httpd│   │   ├── files│   │   │   ├── mysql_wp.sh│   │   │   ├── wordpress-4.7.4-zh_CN.tar.gz│   │   │

源码包编译搭建LNMP+FastCGI平台

源码包编译搭建LNMP+FastCGI平台 搭建环境: CentOS 6.5 软件包版本: nginx-1.2.0.tar.gz mysql-5.5.13.tar.gz php-5.4.9.tar.gz PHP依赖包: mhash-0.9.9.9.tar.gz libiconv-1.13.tar.gz libmcrypt-2.5.8.tar.gz libevent-2.0.21-stable.tar.gz IP地址设置: server:10.21.1.80 client:10.21.1.81 一