PHP站点文件部署:
# mkdir /web
# tar xf phpMyAdmin-4.3.13.1-all-languages.tar.bz2 -C /web/
# mv /web/phpMyAdmin-4.3.13.1-all-languages/ /web/pma
# tar xf wordpress-4.2.2-zh_CN.tar.gz -C /web/
# mv /web/wordpress/ /web/blog
连接数据库:
pma:
# cd /web/pma/
# cp config.sample.inc.php config.inc.php
# vim config.inc.php
> $cfg['blowfish_secret']= 'pma'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
> $cfg['Servers'][$i]['host']= '192.168.1.12';
Blog:
# cd /web/blog/
# cp wp-config-sample.php wp-config.php
# vim wp-config.php
> /** WordPress数据库的名称 */
> define('DB_NAME','blogdb');
>
> /** MySQL数据库用户名 */
> define('DB_USER','bloguser');
>
> /** MySQL数据库密码 */
> define('DB_PASSWORD','blogpass');
>
> /** MySQL主机 */
> define('DB_HOST','192.168.1.12');
创建数据库:
客户端测试:
客户端域名解析通过Hosts文件实现:
站点测试:
至此站点部署完毕,接下来为pma.chencer.org提供https协议。
为站点A提供https协议:
服务器自建CA,自签证书(详细信息见自建CA博客):
# (umask077 ; openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048)
# openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -out /etc/pki/CA/cacert.pem -days 3655
# touch /etc/pki/CA/{index.txt,serial}
# echo 01 > /etc/pki/CA/serial
创建证书,签署请求;
# (umask077 ; openssl genrsa -out /etc/httpd/httpd.key 2048)
# openssl req -new -key /etc/httpd/httpd.key -out /etc/httpd/httpd.csr
# openssl ca -in/etc/httpd/httpd.csr -out /etc/httpd/httpd.crt -days 3650
配置启用ssl功能:
# vim /etc/httpd/httpd.conf
启用ssl模块:
> LoadModulesocache_shmcb_module modules/mod_socache_shmcb.so
> LoadModulessl_module modules/mod_ssl.so
启用ssl功能:
> Include /etc/httpd/extra/httpd-ssl.conf
配置ssl配置文件:
# vim /erc/httpd/extra/httpd-ssl.conf
> <VirtualHost 192.168.1.10:443>
> DocumentRoot "/web/pma"
> ServerName pma.chencer.org
> ProxyRequests Off
> ProxyPassMatch ^/(.*\.php)$ fcgi://192.168.1.11:9000/web/pma/$1
> <Directory "/web/pma">
> Options none
> AllowOverride none
> Require all granted
> </Directory>
> SSLCertificateFile "/etc/httpd/httpd.crt" :指定证书位置;
> SSLCertificateKeyFile "/etc/httpd/httpd.key" :指定公钥位置;
> </VirtualHost>
测试语法,重启服务,查看端口:
客户端安装证书,测试站点:
结语:
源码编译安装分离式LAMP平台的介绍到此结束,由于源码编译不熟练,实验过程中遇到很多问题,也消耗了不少时间;接下来的学习中会对LAMP平台进行扩展应用,请关注后续博客;试验中如有遗漏和失误,欢迎各路大神指正。
下面关于LAMP相关的内容你可能也喜欢: