CentOS-6平台三機編譯安裝FastCGI模型

來源:互聯網
上載者:User

標籤:伺服器   虛擬機器主機   二進位   資料庫安全   wordpress   

LAMP(2)--CentOS-6平台三機編譯安裝FastCGI模型 要求
  • (1) 三者分離於三台主機;(編譯安裝,模組或php-fpm);

  • (2) 一個虛擬機器主機用於提供phpMyAdmin;另一個虛擬機器主機用於提供wordpress;

  • (3) xcache;

  • (4) 嘗試mpm為非prefork機制;

環境規劃
host ip software 平台
主機1 172.18.253.33 httpd CentOS 6
主機2 172.18.253.34 php-fpm CentOS 6
主機3 172.18.253.35 mariadb CentOS 6
配置準備

1.實驗前先將 iptables 和 SELinux 均設定為關閉狀態,避免影響實驗結果。
2.首先配置 mariadb的伺服器主機3,再配置 php-fpm的伺服器主機2,最後配置httpd的伺服器主機1,按照從後到前的順序。

主機3配置
  • 二進位安裝MariaDB

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M02/7F/73/wKiom1ce-vzjT8xFAABp1EG5dvw925.png" title="1.png" alt="wKiom1ce-vzjT8xFAABp1EG5dvw925.png" />

650) this.width=650;" src="http://s5.51cto.com/wyfs02/M01/7F/70/wKioL1ce--3jDzrBAAG-tEvRgbs357.png" title="1.png" alt="wKioL1ce--3jDzrBAAG-tEvRgbs357.png" />

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M02/7F/73/wKiom1ce-0iBGDRQAAHgM_rzFXU006.png" title="1.png" alt="wKiom1ce-0iBGDRQAAHgM_rzFXU006.png" />

650) this.width=650;" src="http://s1.51cto.com/wyfs02/M02/7F/70/wKioL1ce_DDzNJGxAAArBu9gPjY122.png" title="1.png" alt="wKioL1ce_DDzNJGxAAArBu9gPjY122.png" />

  • 初始化資料庫安全設定

mysql_secure_installation

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M00/7F/70/wKioL1ce_wrgxy-WAAE7q9m07NQ138.jpg" title="1.jpg" alt="wKioL1ce_wrgxy-WAAE7q9m07NQ138.jpg" />


  • 配置MariaDB

# 授權root可從172.18.253.0/24網段內的主機登入操作所有資料庫。MariaDB [(none)]> grant all privileges on *.* to ‘root‘@‘172.18.253.%‘ identified by ‘mageedu‘;# 給wordpress建立資料wpdb。MariaDB [(none)]> create database wpdb;# 給wordpress建立使用者wp。MariaDB [(none)]> create user ‘wp‘@‘172.18.253.%‘ identified by ‘mageedu‘;# 授權wp可從172.18.253.0/24網段內的主機登入操作wpdb資料庫。MariaDB [(none)]> grant all privileges on wpdb.* to ‘wp‘@‘172.18.253.%‘ identified by ‘mageedu‘;# 重載許可權表MariaDB [(none)]> flush privileges;# 退出MariaDB [(none)]> \q
主機2配置
  • 測試連接MariaDB

[[email protected] ~]# yum install -y mysql[[email protected] ~]# mysql -uroot -h172.18.253.35 -pmageedu
  • 環境配置:安裝開發套件

# yum -y groupinstall "Server Platform Development" "Development tools"# yum -y install bzip2-devel libmcrypt-devel libxml2-devel
  • 編譯安裝php

  • 650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/7F/71/wKioL1cfB9OTwq-zAAAIVKZZ27M137.jpg" title="1.jpg" alt="wKioL1cfB9OTwq-zAAAIVKZZ27M137.jpg" />


~]# tar -xf  php-5.4.40.tar.bz2~]# ./configure --prefix=/usr/local/php5 --with-openssl --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-sockets  --enable-fpm --with-mcrypt  --with-config-file-path=/etc  --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts~]# make && make install
  • 配置php、php-fpm

# cp php.ini-production /etc/php.ini]# mkdir /etc/php.d/]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf]# vim /usr/local/php/etc/php-fpm.conf# 配置啟用pid檔案和error_logpid = /usr/local/php/var/run/php-fpm.piderror_log = /usr/local/php/var/log/php-fpm/error.log
  • 安裝php-mysql

]# yum -y install php-mysql
  • 編譯安裝xache

# yum install php-devel # cd xcache-3.2.0 # phpize (在目前的目錄產生configure 指令碼,讓它瞭解php環境) # ./configure –enable-xcache –with-php-config=/usr/bin/php-config # make && make install # cp xcache.ini /etc/php.d/
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/7F/74/wKiom1cfGI7icZb0AAHVnSwSe1E185.jpg" title="44d919fd-1d39-458a-83e1-01929eef2d21.jpg" alt="wKiom1cfGI7icZb0AAHVnSwSe1E185.jpg" /> 主機1配置
  • 環境配置:安裝開發套件

# yum -y groupinstall "Server Platform Development" "Development tools"# yum -y install pcre-devel
  • 編譯安裝httpd2.4

  • (1) apr-1.4+

# ./configure  --prefix=/usr/local/apr 【指明安裝到/usr/local/apr目錄下】# make && make install   【第一個命令如果成功運行則執行第二個】
  • (2) apr-util-1.4+

 # ./configure  --prefix=/usr/local/apr-util  --with-apr=/usr/local/apr【當安裝某包時依賴某程式包,告訴他位置,此處 --with-apr=/usr/local/apr 則表示告訴依賴包的 apr包 在 /usr/local/apr目錄下】# make && make install
  • (3) httpd-2.4(安裝時可以指明以那個使用者來運行,不指定的話預設是daemon使用者)

# ./configure –prefix=/usr/local/apache24 –sysconfdir=/etc/httpd24 –enable-so –enable-ssl –enable-cgi –enable-rewrite(支援URL重寫) –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=worker# make && make install
  • 設定httpd24 服務service 啟動 和開機預設啟動方法

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M00/7F/72/wKioL1cfF8Px34M0AADKT4D5DTw462.png" title="1.png" alt="wKioL1cfF8Px34M0AADKT4D5DTw462.png" />

  • 查看驗證是否為worker模型

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/7F/72/wKioL1cfGEqT4XUCAAFB_eA0k_c336.jpg" title="1.jpg" alt="wKioL1cfGEqT4XUCAAFB_eA0k_c336.jpg" />

  • 安裝wordpress(本處提供安裝方法,安裝包自行下載)

650) this.width=650;" src="http://s2.51cto.com/wyfs02/M02/7F/56/wKioL1caPdrws4g9AACYyVQ64os514.png" title="1.png" alt="wKioL1caPdrws4g9AACYyVQ64os514.png" width="650" />

650) this.width=650;" src="http://s1.51cto.com/wyfs02/M00/7F/60/wKioL1cciDTA92w8AAAG04_-USQ235.png" title="1.png" alt="wKioL1cciDTA92w8AAAG04_-USQ235.png" width="650" />

  • 安裝phpMyAdmin(本處提供安裝方法,安裝包自行下載)

cp phpMyAdmin-4.4.14.1-all-language.zip /webcom/c.org/pmaunzip phpMyAdmin-4.4.14.1-all-language.zipln -sv phpMyAdmin-4.4.14.1-all-language phpadmincd phpadmin/cp config.sample.inc.php config.inc.phpopenssl rand -base64 15vim config.inc.phpsystemctl restart httpd.service

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M02/7F/74/wKiom1cfGWfDL2zAAAA-1BejEHc750.png" title="1.png" alt="wKiom1cfGWfDL2zAAAA-1BejEHc750.png" />

  • 配置虛擬機器主機1

[[email protected] ~]# vim /etc/httpd/conf.d/virtualhost1.conf<VirtualHost *:80>        ServerName www.b.net        DocumentRoot "/webcom/b.net/wp"        <Directory "/webcom/b.net/wp">                Options None                AllowOverride None                Require all granted        </Directory></VirtualHost>[[email protected] ~]# mkdir -pv /webcom/b.net/wpmkdir: created directory ‘/webcom/b.net’mkdir: created directory ‘/webcom/b.net/wp’
  • 配置虛擬機器主機2

[[email protected] ~]# vim /etc/httpd/conf.d/virtualhost2.conf<VirtualHost *:80>        ServerName www.c.org        DocumentRoot "/webcom/c.org/pma"        <Directory "/webcom/c.org/">                Options None                AllowOverride None                Require all granted        </Directory></VirtualHost>[[email protected] ~]# mkdir -pv /webcom/c.org/pmamkdir: created directory ‘/webcom/c.org’mkdir: created directory ‘/webcom/c.org/pma’


至此,實驗完成!

CentOS-6平台三機編譯安裝FastCGI模型

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.