標籤:分布式部署lamp phpmyadmin wordpress的安裝與應用
系統內容:centos7,httpd-2.4,php-5.5,mariadb5.5
192.168.1.20 httpd
192.168.1.30 PHP
192.168.1.40 mariadb
修改客戶機hosts檔案
[[email protected] Desktop]# vim /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.1.20 www.pma.com www.wp.com
在192.168.1.20上安裝httpd服務
[[email protected] yum.repos.d]# yum -yinstall httpd
修改mpm編輯模組為event
[[email protected] yum.repos.d]# cd/etc/httpd/conf.modules.d/[[email protected] conf.modules.d]# vim00-mpm.conf
# Select the MPM module which should beused by uncommenting exactly# one of the following LoadModule lines: # prefork MPM: Implements a non-threaded, pre-forkingweb server# See:http://httpd.apache.org/docs/2.4/mod/prefork.html#LoadModulempm_prefork_module modules/mod_mpm_prefork.so # worker MPM: Multi-Processing Moduleimplementing a hybrid# multi-threaded multi-process web server# See: http://httpd.apache.org/docs/2.4/mod/worker.html##LoadModule mpm_worker_modulemodules/mod_mpm_worker.so # event MPM: A variant of the worker MPMwith the goal of consuming# threads only for connections with activeprocessing# See: http://httpd.apache.org/docs/2.4/mod/event.html#LoadModulempm_event_module modules/mod_mpm_event.so
編輯wordpress虛擬機器主機設定檔
[[email protected] conf.d]# cd/etc/httpd/conf.d[[email protected] conf.d]# vim wp.conf <VirtualHost *:80> ServerName www.wp.com DocumentRoot /wordpress/wordpress ProxyRequests off DirectoryIndex index.php ProxyPassMatch ^/(.*.php)$fcgi://192.168.1.30:9000/wordpress/wordpress/$1 <Directory "/wordpress/wordpress"> Options None AllowOverride None Require all granted </Directory></VirtualHost>
編輯phpmyadmin虛擬機器主機設定檔
[[email protected] conf.d]# vim pma.conf<VirtualHost *:80> ServerName www.pma.com DocumentRoot /usr/share/phpMyAdmin ProxyRequests off DirectoryIndex index.php ProxyPassMatch ^/(.*.php)$fcgi://192.168.1.30:9000/usr/share/phpMyAdmin/$1 <Directory "/usr/share/phpMyAdmin"> Options None AllowOverride None Require all granted </Directory></VirtualHost>
建立相應檔案夾
[[email protected] conf.d]# mkdir -p/usr/share/phpMyAdmin
重新載入httpd服務
[[email protected] conf.d]# systemctl reloadhttpd
在192.168.1.30上安裝php-fpmphp-mysql
[[email protected] ~]# yum install -y php-fpmphp-mysql
修改php-fpm設定檔,將監聽IP地址改為本機地址
[[email protected] ~]# cd /etc/php-fpm.d/[[email protected] php-fpm.d]# vim www.conflisten = 192.168.1.30:9000 ###通過網路連接可用的IP及連接埠listen.allowed_clients = 192.168.1.20 ###允許那台主機串連至本機
啟動php-rpm
[[email protected] php-fpm.d]# systemctl statusphp-fpm
在192.168.1.40上安裝mariadb
[[email protected] yum.repos.d]# yum -yinstall mariadb-service mariadb
建立資料庫wpdb
MariaDB [(none)]> grant all on wpdb.* [email protected]‘192.168.%.%‘ identified by ‘pass‘;Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> create database wpdb;Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.00 sec)ry OK,0 rows affected (0.00 sec)
建立phpmyadmin用帳號
MariaDB [(none)]> create [email protected]‘192.168.%.%‘ identified by ‘mppass‘;Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> grant all on *.* [email protected]‘192.168.%.%‘ identified by ‘mppass‘;Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flash privileges;Query OK, 0 rows affected (0.00 sec)
安裝WordPress(這裡是直接將WordPress在windows中直接拷貝入linux中)
[[email protected] conf.d]# cd /wordpress/[[email protected] wordpress]# unzipwordpress-4.5.3-zh_CN.zip[[email protected] wordpress]# cd/wordpress/wordpress/
修改設定檔
[[email protected] wordpress]# mvwp-config-sample.php wp-config.php[[email protected] wordpress]# vimwp-config.php
// ** MySQL 設定 - 具體資訊來自您正在使用的主機 ** ///** WordPress資料庫的名稱*/define(‘DB_NAME‘, ‘wpdb‘); /** MySQL資料庫使用者名稱 */define(‘DB_USER‘, ‘wpuser‘); /** MySQL資料庫密碼 */define(‘DB_PASSWORD‘, ‘wppass‘); /** MySQL主機 */define(‘DB_HOST‘, ‘192.168.1.40‘);
配置好資料庫後進行www.wp.com的驗證
650) this.width=650;" src="http://s1.51cto.com/wyfs02/M01/84/52/wKioL1eM5W6ze7S1AADtw2OFAnQ637.png" title="1.png" alt="wKioL1eM5W6ze7S1AADtw2OFAnQ637.png" />
PS:若顯示亂碼,在httpd伺服器對應虛擬機器主機DocumentRoot安裝wordpress,即可。
安裝phpmyadmin
[[email protected] conf.d]# yum -y installphpmyadmin
添加mysql的伺服器位址
$cfg[‘Servers‘][$i][‘host‘] = ‘192.168.1.40‘; // MySQL hostnameor IP address
修改phpMyAdmin的配置資訊
[[email protected] phpMyAdmin]# cd/etc/phpMyAdmin/[[email protected] phpMyAdmin]# vimconfig.inc.php
登入驗證
650) this.width=650;" src="http://s4.51cto.com/wyfs02/M00/84/52/wKioL1eM5ZzS_lDSAAIEqCppJBM364.png" title="2.png" alt="wKioL1eM5ZzS_lDSAAIEqCppJBM364.png" />
PS:若顯示亂碼,在httpd伺服器對應虛擬機器主機DocumentRoot安裝phpMyAdmin,即可。
分布式部署lamp,phpmyadmin,wordpress的安裝與應用