八.接下来开始安装phpMyadmin。
1.虚拟主机已经创建完成,phpMyAdmin不需要在数据库中加入库,账户密码
解压程序包
[root@php~]# unzip phpMyAdmin-4.3.2-all-languages.zip
移动到特定网站目录:
[root@php~]# mv phpMyAdmin-4.3.2-all-languages/* /web/vhosts/www1/pmp/
创建配置文件:
[root@php~]# cd /web/vhosts/www1/pmp/
[root@phppmp]# cp config.sample.inc.php config.inc.php
2.设置配置文件:
设置随机数,为了安全吧!
[root@phppmp]# openssl rand -hex 8 | md5sum
80912828243ccf7033298368628ad07d -
[root@phppmp]# vim config.inc.php
$cfg['blowfish_secret']= '80912828243ccf7033298368628ad07d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH!*/
#将数据库IP更改为数据库地址:
$cfg['Servers'][$i]['host']= '172.16.31.21';
3.同样的,将phpMyAdmin数据复制一份到httpd主机。
[root@php~]# scp -r /web/vhosts/www1/pmp/* root@172.16.31.20:/web/vhosts/www1/pmp/
安装phpMyamin完成!!!
九.phpMyAdmin传输是明文的,不是很可靠,现在给转换成以https加密传输访问。
1.找到httpd-ssl.conf的配置,默认是注释掉的。
开启模块及开启ssl配置文件:
1 2 3 4 5
[root@www~]# vim /etc/httpd24/httpd.conf LoadModulesocache_shmcb_modulemodules/mod_socache_shmcb.so LoadModulessl_module modules/mod_ssl.so # Secure(SSL/TLS) connections Include/etc/httpd24/extra/httpd-ssl.conf
2.现在把数据库的主机做为CA服务器。
a.生成密钥。
1 2 3 4 5
[root@MySQLCA]# (umask 077; openssl genrsa -out private/cakey.pem 2048) GeneratingRSA private key, 2048 bit long modulus ....+++ ............................................+++ e is65537 (0x10001)
b.生成自签署证书
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[root@mysqlCA]# openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 3650 You areabout to be asked to enter information that will be incorporated into yourcertificate request. What youare about to enter is what is called a Distinguished Name or a DN. There arequite a few fields but you can leave some blank For somefields there will be a default value, If youenter '.', the field will be left blank. ----- CountryName (2 letter code) [XX]:CN State orProvince Name (full name) []:HA LocalityName (eg, city) [Default City]:ZZ OrganizationName (eg, company) [Default Company Ltd]:stu31 OrganizationalUnit Name (eg, section) []:ops CommonName (eg, your name or your server's hostname) []:mysql.stu31.com EmailAddress []:mysql@stu31.com
c.创建索引库及序列号文件
[root@mysqlCA]# touch index.txt serial
[root@mysqlCA]# echo 01 >serial
3.httpd主机设置证书
a.生成密钥
1 2 3 4 5 6 7 8 9 10
[root@www~]# cd /etc/httpd24/ [root@wwwhttpd24]# ls extra httpd.conf magic mime.types original [root@wwwhttpd24]# mkdir certs [root@wwwhttpd24]# cd certs [root@wwwcerts]# (umask 077 ; openssl genrsa -out httpd.key 2048) GeneratingRSA private key, 2048 bit long modulus ...........................................................................................................................................................................................................................................................................................................................+++ .............................................+++ e is65537 (0x10001)
b.生成证书签署申请
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
[root@wwwcerts]# openssl req -new -key httpd.key -out httpd.csr You areabout to be asked to enter information that will be incorporated into yourcertificate request. What youare about to enter is what is called a Distinguished Name or a DN. There arequite a few fields but you can leave some blank For somefields there will be a default value, If youenter '.', the field will be left blank. ----- CountryName (2 letter code) [XX]:CN State orProvince Name (full name) []:HA LocalityName (eg, city) [Default City]:ZZ OrganizationName (eg, company) [Default Company Ltd]:stu31 OrganizationalUnit Name (eg, section) []:ops CommonName (eg, your name or your server's hostname) []:pmp.stu31.com EmailAddress []:pmp@stu31.com Pleaseenter the following 'extra' attributes to besent with your certificate request Achallenge password []: Anoptional company name []:
c.将https.csr复制到证书服务器主机。
1 2 3
[root@wwwcerts]# scp httpd.csr root@172.16.31.21:/etc/pki/CA root@172.16.31.21'spassword: httpd.csr 100%1029 1.0KB/s 00:00
4.证书服务器签署证书
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
[root@mysqlCA]# openssl ca -in httpd.csr -out https.crt -days 3650 Usingconfiguration from /etc/pki/tls/openssl.cnf Checkthat the request matches the signature Signatureok CertificateDetails: Serial Number: 1 (0x1) Validity Not Before: Dec 20 20:20:17 2014GMT Not After : Dec 17 20:20:17 2024GMT Subject: countryName = CN stateOrProvinceName = HA organizationName = stu31 organizationalUnitName = ops commonName = pmp.stu31.com emailAddress = pmp@stu31.com X509v3 extensions: X509v3 Basic Constraints: CA:FALSE Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: 81:56:C1:E9:31:EB:31:40:1C:A1:FE:19:6F:A8:14:59:AF:9B:80:97 X509v3 Authority Key Identifier: keyid:3A:65:60:42:6A:F7:C6:7B:C5:60:29:DC:BF:F8:39:AD:4F:54:52:01 Certificateis to be certified until Dec 17 20:20:17 2024 GMT (3650 days) Sign thecertificate? [y/n]:y 1 out of1 certificate requests certified, commit? [y/n]y Write outdatabase with 1 new entries Data BaseUpdated
5.签署完成后还有将证书发送到http主机。
1 2 3 4 5 6 7
[root@mysqlCA]# scp https.crt root@172.16.31.20:/etc/httpd24/certs/ Theauthenticity of host '172.16.31.20 (172.16.31.20)' can't be established. RSA keyfingerprint is b8:a4:da:03:91:67:32:2f:d5:72:0b:77:3b:6f:ba:30. Are yousure you want to continue connecting (yes/no)? yes Warning:Permanently added '172.16.31.20' (RSA) to the list of known hosts. root@172.16.31.20'spassword: https.crt 100%4555 4.5KB/s 00:00
6.编辑httpd-ssl.conf,定义主机,指定密钥文件等。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
[root@wwwhttpd24]# vim extra/httpd-ssl.conf <VirtualHost_default_:443> DocumentRoot"/web/vhosts/www1/pmp" ServerNamebbs.stu31.com:443 ProxyRequestsOff ProxyPassMatch^/(.*\.php)$ fcgi://172.16.31.22:9000/web/vhosts/www1/pmp/$1 <Directory"/web/vhosts/www1/pmp"> Options none AllowOverride none Require all granted </Directory> ErrorLog"/web/vhosts/www1/logs/https-error_log" TransferLog"/web/vhosts/www1/logs/https-access_log" SSLEngineon SSLCertificateFile"/etc/httpd24/certs/https.crt" SSLCertificateKeyFile"/etc/httpd24/certs/httpd.key"
重启httpd服务。
7.将CA服务器里的证书拷贝到windowsXP里面安装测试
拷贝的是CA服务器的证书哦!别拷贝错误啦!
安装证书在客户端:
安装完成后进行测试:
这样phpMyadmin加密 传输就完成啦!!!!!o(∩_∩)o
使用ab测试网站速度:
先缓存一些:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
[root@www~]# ab -c 10 -n 100 This isApacheBench, Version 2.3 <$Revision: 1604373 $> Copyright1996 Adam Twiss, Zeus Technology Ltd, Licensedto The Apache Software Foundation, Benchmarkingpmp.stu31.com (be patient).....done ServerSoftware: Apache/2.4.10 ServerHostname: pmp.stu31.com ServerPort: 80 DocumentPath: /index.php DocumentLength: 8993 bytes ConcurrencyLevel: 10 Timetaken for tests: 5.495 seconds Completerequests: 100 Failedrequests: 0 Totaltransferred: 1026300 bytes HTMLtransferred: 899300 bytes Requestsper second: 18.20 [#/sec] (mean) #我们注重的是平均每秒处理的请求数!!!才18.2个请求每秒!!! Time perrequest: 549.503 [ms] (mean) Time perrequest: 54.950 [ms] (mean, acrossall concurrent requests) Transferrate: 182.39 [Kbytes/sec]received ConnectionTimes (ms) min mean[+/-sd] median max Connect: 0 0 1.6 0 9 Processing: 271 537 149.9 538 1502 Waiting: 263 502 146.9 497 1462 Total: 271 537 150.1 538 1503 Percentageof the requests served within a certain time (ms) 50% 538 66% 556 75% 572 80% 586 90% 703 95% 728 98% 849 99% 1503 100% 1503 (longest request)
再进行大型并发测试:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
[root@www~]# ab -c 100 -n 1000 This isApacheBench, Version 2.3 <$Revision: 1604373 $> Copyright1996 Adam Twiss, Zeus Technology Ltd, Licensedto The Apache Software Foundation, Benchmarkingpmp.stu31.com (be patient) Completed100 requests Completed200 requests Completed300 requests Completed400 requests Completed500 requests Completed600 requests Completed700 requests Completed800 requests Completed900 requests Completed1000 requests Finished1000 requests ServerSoftware: Apache/2.4.10 ServerHostname: pmp.stu31.com ServerPort: 80 DocumentPath: /index.php DocumentLength: 8993 bytes ConcurrencyLevel: 100 Timetaken for tests: 56.817 seconds Completerequests: 1000 Failedrequests: 0 Totaltransferred: 10263000 bytes HTMLtransferred: 8993000 bytes Requestsper second: 17.60 [#/sec] (mean) Time perrequest: 5681.702 [ms] (mean) Time perrequest: 56.817 [ms] (mean, acrossall concurrent requests) Transferrate: 176.40 [Kbytes/sec]received ConnectionTimes (ms) min mean[+/-sd] median max Connect: 0 4 15.0 0 81 Processing: 473 5505 979.8 5709 6616 Waiting: 441 5363 953.4 5547 6444 Total: 482 5510 973.2 5711 6616 Percentageof the requests served within a certain time (ms) 50% 5711 66% 5794 75% 5870 80% 5936 90% 6100 95% 6209 98% 6404 99% 6456 100% 6616 (longest request)