LAMP的搭建:
成都創(chuàng)新互聯(lián)公司服務(wù)項(xiàng)目包括永順網(wǎng)站建設(shè)、永順網(wǎng)站制作、永順網(wǎng)頁(yè)制作以及永順網(wǎng)絡(luò)營(yíng)銷策劃等。多年來(lái),我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,永順網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到永順省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
使用兩臺(tái)虛擬機(jī),一臺(tái)虛擬機(jī)安裝httpd及php,把php作為模塊編譯進(jìn)httpd中,另一臺(tái)安裝MySQL,讓php能調(diào)用mysql來(lái)讀取數(shù)據(jù)。
虛擬機(jī)1:172.18.250.76 Centos6.7 安裝httpd、php
虛擬機(jī)2:172.18.250.10 Centos6.7 安裝mysql
利用httpd創(chuàng)建兩基于域名的虛擬主機(jī),分別運(yùn)行wordpress博客和phpmyadmin數(shù)據(jù)庫(kù)。
一:yum安裝httpd
[root@localhost ~]# yum -y install httpd
1、編輯配置文件,注釋DocumentRoot
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf #DocumentRoot "/var/www/html"
2、創(chuàng)建虛擬主機(jī)文件,編輯文件
[root@localhost php]# vim /etc/httpd/conf.d/vhost.conf NameVirtualHost 172.18.250.76:80 <VirtualHost 172.18.250.76:80> ServerName www.a.com DocumentRoot "/www/blog" <Directory " "> Options None Allowoverride None Order allow,deny allow from all </Directory> </virtualHost> <VirtualHost 172.18.250.76:80> ServerName www.b.net DocumentRoot "/www/php" <Directory " "> Options None Allowoverride None Order allow,deny allow from all </Directory> </virtualHost>
3、啟動(dòng)httpd服務(wù),查看監(jiān)聽(tīng)端口
[root@localhost php]# netstat -ntlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 :::80 :::* LISTEN 2201/httpd
4、創(chuàng)建虛擬主機(jī)路徑,并驗(yàn)證能否正常訪問(wèn)
[root@localhost conf.d]# mkdir -p /www/blog [root@localhost conf.d]# mkdir -p /www/php [root@localhost conf.d]# cd /www/php [root@localhost php]# echo " [root@localhost conf.d]# cd /www/blog [root@localhost blog]# echo "www.a.com">index.html
重啟httpd服務(wù),驗(yàn)證:
二、yum安裝php
[root@localhost php]# yum -y install php [root@localhost php]# httpd -M //查看httpd所加載的模塊 php5_module (shared) //php已經(jīng)編輯進(jìn)httpd
驗(yàn)證php能否正常加載:
[root@localhost php.d]# vim /www/blog/index.php <?php phpinfo(); ?>
三、安裝mysql
[root@lsj ~]# yum -y install mysql-server [root@lsj ~]# service mysqld start
授權(quán)一個(gè)遠(yuǎn)程賬號(hào),讓PHP能訪問(wèn)mysql
mysql> grant all on *.* to admin@'172.18.250.76' identified by "admin";
安裝mysql驅(qū)動(dòng),支持php遠(yuǎn)程
[root@localhost modules]# yum -y install php-mysql [root@localhost modules]# vim /www/blog/index.php <?php $conn = mysql_connect ('172.18.250.10','admin','admin'); if ($conn) echo "success"; else echo "false" ?>
四、安裝wordpress和phpmyadmin軟件
[root@localhost wordpress]# unzip wordpress-4.3.1-zh_CN.zip [root@localhost blog]# cd wordpress [root@localhost wordpress]# cp wp-config-sample.php wp-config.php [root@localhost wordpress]# vim wp-config.php /** WordPress數(shù)據(jù)庫(kù)的名稱 */ define('DB_NAME', 'mytest'); /** MySQL數(shù)據(jù)庫(kù)用戶名 */ define('DB_USER', 'admin'); /** MySQL數(shù)據(jù)庫(kù)密碼 */ define('DB_PASSWORD', 'admin'); /** MySQL主機(jī) */ define('DB_HOST', '172.18.250.10');
驗(yàn)證能都正常登陸:
登陸博客:
[root@localhost blog]# cd /www/php/ [root@localhost php]# unzip phpMyAdmin-4.4.14.1-all-languages.zip [root@localhost php]# ln -s phpMyAdmin-4.4.14.1-all-languages pma
生成一段隨機(jī)數(shù),用作登陸phpmyadmin
[root@localhost pma]# cp config.sample.inc.php config.inc.php [root@localhost pma]# openssl rand -base64 30 d8yhR7wOU5+HzeZjGEusyAmNiQv/+rTzWQuoDiCR [root@localhost pma]# vim config.inc.php $cfg['blowfish_secret'] = 'd8yhR7wOU5+HzeZjGEusyAmNiQv/+rTzWQuoDiCR'; $cfg['Servers'][$i]['host'] = '172.18.250.10';
驗(yàn)證網(wǎng)頁(yè)是否能打開(kāi):
安裝個(gè)php-mbstring,支持中文字符集
[root@localhost pma]# rpm -ivh php-mbstring-5.3.3-40.el6_6.x86_64.rpm
刷新頁(yè)面:
輸入剛才授權(quán)的賬號(hào)密碼:
。。。。。。
解決思路:
1、升級(jí)mysql版本。
2、降級(jí)phpmyadmin版本。
降低版本的方法:
[root@localhost pma]# cd libraries/ [root@localhost libraries]# vim common.inc.php if (PMA_MYSQL_INT_VERSION < 50500) { 改成 if (PMA_MYSQL_INT_VERSION < 50100 {
再次刷新,輸入賬號(hào)密碼:
OK,數(shù)據(jù)庫(kù)登錄成功。
五、安裝Xcache對(duì)php進(jìn)行加速
[root@localhost libraries]# yum -y install php-xcache
1、先測(cè)試沒(méi)開(kāi)啟加速前的請(qǐng)求速度:
[root@localhost setup]# ab -n100 -c10 http://172.18.250.76/wordpress/index.php Benchmarking 172.18.250.76 (be patient).....done Server Software: Apache/2.2.15 Server Hostname: 172.18.250.76 Server Port: 80 Document Path: /wordpress/index.php Document Length: 0 bytes Concurrency Level: 10 Time taken for tests: 4.792 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Non-2xx responses: 100 Total transferred: 36800 bytes HTML transferred: 0 bytes Requests per second: 20.87 [#/sec] (mean) Time per request: 479.161 [ms] (mean) Time per request: 47.916 [ms] (mean, across all concurrent requests) Transfer rate: 7.50 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 3.8 0 20 Processing: 143 459 331.6 352 1783 Waiting: 143 458 331.6 343 1783 Total: 143 460 331.4 360 1783 Percentage of the requests served within a certain time (ms) 50% 360 66% 405 75% 512 80% 581 90% 895 95% 1375 98% 1720 99% 1783 100% 1783 (longest request)
2、重啟httpd服務(wù),開(kāi)啟Xcache,在測(cè)試下
[root@localhost setup]# ab -n100 -c10 Benchmarking 172.18.250.76 (be patient).....done Server Software: Apache/2.2.15 Server Hostname: 172.18.250.76 Server Port: 80 Document Path: /wordpress/index.php Document Length: 0 bytes Concurrency Level: 10 Time taken for tests: 1.659 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Non-2xx responses: 100 Total transferred: 36800 bytes HTML transferred: 0 bytes Requests per second: 60.27 [#/sec] (mean) //三倍加速請(qǐng)求 Time per request: 165.908 [ms] (mean) Time per request: 16.591 [ms] (mean, across all concurrent requests) Transfer rate: 21.66 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 2.6 0 10 Processing: 41 158 27.5 158 235 Waiting: 40 158 27.6 158 235 Total: 41 159 28.7 158 245 Percentage of the requests served within a certain time (ms) 50% 158 66% 166 75% 168 80% 171 90% 192 95% 213 98% 240 99% 245 100% 245 (longest request)
六:對(duì)訪問(wèn)phpmyadmin網(wǎng)頁(yè)時(shí)進(jìn)行SSL加密認(rèn)證
簽證及CA認(rèn)證是怎么進(jìn)行可以參考我的博文:Linux中加密解密技術(shù)及CA認(rèn)證
1、先下載mod_ssl模塊,因?yàn)閔ttpd2.2沒(méi)包含這個(gè)模塊
[root@localhost ssl]# yum -y install mod_ssl
2、編輯/etc/httpd/conf.d/ssl.conf文件
[root@localhost ssl]# vim /etc/httpd/conf.d/ssl.conf DocumentRoot "/www/php" //取消注釋,修改虛擬主機(jī)的url ServerName //虛擬主機(jī)名 SSLEngine on //確保為on SSLCertificateFile /etc/httpd/ssl/httpd.crt //存放簽署的證書(shū) SSLCertificateFile /etc/httpd/ssl/httpd.key //存放私鑰的位置
3、重啟httpd服務(wù)器,查看443端口是否啟用
[root@localhost ssl]# netstat -ntlp tcp 0 0 :::443 :::* LISTEN 6080/httpd
4、驗(yàn)證頁(yè)面是否能訪問(wèn)
5、從虛擬機(jī)把CA證書(shū)下載到windows主機(jī)上
[root@www CA]# sz cacert.pem
6、把證書(shū)導(dǎo)入到瀏覽器當(dāng)中
7、重新打開(kāi)瀏覽器,輸入虛擬主機(jī)名:
網(wǎng)站欄目:yum安裝lamp及Xcache加速
轉(zhuǎn)載來(lái)于:http://www.rwnh.cn/article32/pgcipc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開(kāi)發(fā)、Google、虛擬主機(jī)、品牌網(wǎng)站制作、外貿(mào)建站、做網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)