一、项目设计
I. PROJECT DESTRUCTION
创新互联公司是一家专注于成都网站建设、网站设计与策划设计,仲巴网站建设哪家好?创新互联公司做网站,专注于网站建设十余年,网设计领域的专业建站公司;建站业务涵盖:仲巴等地区。仲巴做网站价格咨询:13518219792CentOS 6.6:配置双网卡,提供编译开发环境 ;
& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; CentOS 6.6: Configure double-net cards to provide compilation and development environment & nbsp;
编译安装httpd 2.4.9:建立两个虚拟主机站点www.a.com(172.16.13.20)和 www.b.org(13.21);
& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; compiled and installed httpd 2.4.9: Establishment of two virtual hosting sites: www.a.com(172.16.13.20) and www.b.org (13.21);
二进制码格式安装MariaDB;
& nbsp; & nbsp; & nbsp; & nbsp; and installation of MariaDB in binary code format;
php-5.4.26附加为httpd模块进行编译安装;
& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; php-5.4.26 attached to the compilation and installation of the httpd module;
编译安装xcache,实现php模块加速;
& nbsp; & nbsp; & nbsp; & nbsp; compile and install xcache to accelerate the php module;
使用3w.a.com实现drupal
& nbsp; & nbsp; & nbsp; & nbsp; use 3w.a.com to achieve drupal
使用3w.b.org 以https方式实现phpMyAdmin
& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & use 3w.b.org to achieve phpMyAdmin by https
二、配置双网卡,绑定ip,提供开发环境
ii. Configure the two-net cards, bind the ip and provide the development environment
1.给虚拟机centos6.6添加两块网卡
1. Add two webcards to the virtual computer Centos 6.6
2.修改/etc/sysconfig/network-scripts/ifcfg-eth0 IPADDR=172.16.13.20
2. Modification/etc/sysconfig/network-scripts/ifcfg-eth0 IPADDR = 172.16.13.20
新建/etc/sysconfig/network-scripts/ifcfg-eth2 IPADDR=172.16.13.21
& nbsp; & nbsp; new/etc/sysconfig/network-scripts/ifcfg-eth2 IPADDR = 172.16.13.21
3.提供编译开发环境:
3. Provision of compilation and development environment:
yum grouplist
yum groupinstall "Development tools" "Server Platform Development"
三、编译安装apache
& nbsp; & nbsp; iii. compile and install apace
1.解决依赖关系
1. Addressing dependency
httpd-2.4.9需要较新版本的apr和apr-util的支持
& nbsp; & nbsp; httpd-2.4.9 Support for newer versions of apr and apr-util
从网上获取 最新版本 apr-1.5.0.tar.bz2和 apr-util-1.5.3.tar.bz2
& nbsp; & nbsp; Obtaining the most recent versions from the Web & nbsp; apr-1.5.0.tar.bz2 and apr-util-1.5.3.tar.bz2
(1)编译安装apr
& nbsp; & nbsp; (1) compile and install apr
tar xf apr-1.5.0.tar.bz2
cd apr-1.5.0
http://gdruijie.cn/article/configure --prefix=/usr/local/apr
make && make install
(2)编译安装apr-util
& nbsp; & nbsp; (2) compile and install apr-util
tar xf apr-util-1.5.3.tar.bz2
cd apr-util-1.5.3
http://gdruijie.cn/article/configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
(3)安装依赖包pcre-devel
& nbsp; & nbsp; & nbsp; (3) Installation Reliance Packagepcre-devel
yum install pcre-devel
2.编译安装apache
Compilation and installation of apace
下载httpd-2.4.9到本地
& nbsp; & nbsp; downloading httpd-2.4.9 to local
# tar xf httpd-2.4.9.tar.bz2
# cd httpd-2.4.9
# http://gdruijie.cn/article/configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --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=event
# make && make install
3.修改httpd的主配置文件,设置其pid文件路径
3. Modify the main profile of httpd and set its Pid file path
# vim /etc/httpd24/httpd.conf 添加内容
& nbsp; # vim/etc/httpd24/httpd.conf add
PidFile "/var/run/httpd.pid"
4.提供SysV风格服务脚本
4. Provision of SysV-style service scripts
# cp /etc/rc.d/init.d/httpd /etc/rc.d/init.d/httpd24
# vim /etc/rc.d/init.d/httpd
5.设置apachectl默认读取路径
5. Sets the default reading path for apachartl
# vim /etc/profile.d/httpd.sh 添加内容
#vim/etc/profile.d/httpd.sh Add
export PATH=/usr/local/apache/bin:$PATH
6.设置头文件软链接路径
6. Set up a soft link path for headers
ln -sv /usr/local/apache/include/ /usr/include/httpd
7.配置两个虚拟主机站点
Configure two virtual host sites
(1)创建两个站点主页目录
& nbsp; & nbsp; (1) Create two site homepage directories
# mkdir /vhosts/{a.com,b.org}/html -pv
# vim /vhosts/a.com/html/index.html
# vim /vhosts/b.org/html/index.html
(2)开启虚拟站点及其模块文件
& nbsp; & nbsp; & nbsp; (2) opening virtual sites and their modular files
#vim /etc/httpd24/httpd.conf 开启
& nbsp; & nbsp; #vim/etc/httpd24/httpd.conf & nbsp; open
Include /etc/httpd24/extra/httpd-vhosts.conf
开启模块:
& nbsp; & nbsp; open module:
(3)172.16.13.20和172.16.13.21
& nbsp; & nbsp; (3) 172.16.13.20 and 172.16.13.21
# vim /etc/httpd24/extra/httpd-vhosts.conf
8.给172.16.13.21(3w.b.org)开启ssl,实现https访问b.org
Opening of ssl for 172.16.13.21 (3w.b.org) to achieve https accessb.org
(1)给b.org创建私钥和证书申请
& nbsp; & nbsp; (1) request to create private keys and certificates for b.org
# mkdir -pv /etc/httpd24/ssl
# cd /etc/httpd24/ssl
# (umask 077; openssl genrsa -out server.key 2048)
# openssl req -new -key http://gdruijie.cn/article/server.key -out http://gdruijie.cn/article/server.csr -days 90
(2)将证书申请发给私建CA服务器,签发证书后发还给b.org
& nbsp; & nbsp; (2) send the certificate application to a privately built CA server and return it to b.org after issuing the certificate
# scp http://gdruijie.cn/article/server.csr root@172.16.13.201:/tmp
切换到172.16.13.201,签发证书
& nbsp; & nbsp; switch to 172.16.13.201, issue certificate
# openssl ca -in /tmp/server.csr -out /tmp/server.crt -days 90
# scp /tmp/server.crt root@172.16.13.20:/etc/httpd24/ssl
(3)开启ssl功能,配置ssl.conf文件
& nbsp; & nbsp; & nbsp; (3) start ssl functions and configure ssl.conf files
# vim /etc/httpd24/httpd.conf开启
& nbsp; & nbsp; & nbsp; # vim/etc/httpd24/httpd.conf
Include /etc/httpd24/extra/httpd-ssl.conf
开启相关模块:
& nbsp; & nbsp; & nbsp; Open relevant modules:
LoadModule ssl_module modules/mod_ssl.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
配置ssl.conf文件
& nbsp; & nbsp; & nbsp; Configure ssl.conf files
# vim /etc/httpd24/extra/httpd-ssl.conf
(4)开启httpd24服务
& nbsp; & nbsp; (4) Opening of httpd24 service
#httpd -t (查看配置文件有没有错误)
& nbsp; & nbsp; #httpd-t & nbsp; see if there is an error in the configuration file)
# service httpd24 start ( 注意:一定是 httpd24不能写成http,因为虚拟机上装有httpd-2.2)
& nbsp; & nbsp; #service httpd24 start & nbsp; (Note: httpd24 must not be written as http, because the virtual machine is equipped with httpd-2.2)
# ss -tnl (查看对应的80端口,和ssl对应的443端口是不是开启)
& nbsp; & nbsp; #ss-tnl & nbsp; & & & & & nbsp; & & & &
(5)测试证书有效性
& nbsp; & nbsp; (5) test certificate validity
# scp /etc/pki/CA/cacert.pem root@172.16.13.21:/tmp (将根证书复制到b.org主机/tmp目录中)
& nbsp; & nbsp; #scp/etc/pki/CA/caert.pem root@172.16.13.21:/tmp (copy root certificate in b.org host/tmp directory)
#openssl s_client connect 172.16.13.21:443 CAfile /tmp/cacert.pem
(在b.org主机测试证书可不可以使用,如果返回值为9,说明两台主机的时间不一致,返回值 为21说明给的路径错误,返回值为0说明证书有效可用)
& nbsp; (The return value of the host certificate in b.org can be used if the return value of the certificate is 9, indicates that the time of the two hosts is inconsistent, the return value is 21 for the path error given, the return value is 0 for the certificate is valid)
9.测试
9. Testing
(1)在windonws浏览器上输入172.16.13.20测试a.com
& nbsp; & nbsp; (1) Enter 172.16.13.20 testa.com on the windonws browser
(2)在浏览器输入https://172.16.13.21测试b.org
& nbsp; & nbsp; (2) Enter on browser https://172.16.13.21 testb.org
四、安装二进制格式MariaDB
IV. Installation of the binary format MariaDB
1.新建逻辑空间
1. New logical space
准备一个大小20G的分区sda5,磁盘系统为8e
Prepare a 20G-sized partition sda5, disk system 8e.
pvcreate /dev/sda5
vgcreate myvg /dev/sda5
lvcreate -L 10G -n mydata myvg
mke2fs -t ext4 -L MYDATA /dev/myvg/mydata
编辑/etc/fstab文件实现开机自动挂载
Automatically mount edit/etc/fstab files
创建/data目录挂载逻辑空间mydata
Create/data directory mount logic spacemydata
mount /dev/myvg/mydata /data
2.下载MariaDB安装包并解压至 /usr/local下
Download MariaDB installation packages and unpressurize to
under /usr/local
3.所有的程序都应该以普通用户身份运行
All programs should run as regular users
4.初始化mysql
4. Initialization of mysql
把配置文件的模板样本复制一份到 /etc/mysql
Copy a template sample of the profile to / etc/mysql
cp /usr/local/mysql/support-files/my-large.cnf /etc/mysql/my.cnf
vim /etc/mysql/my.cnf添加一些内容
vim /etc/mysql/my.cnf add something
执行初始化脚本
Execute Initial Script
5.编辑数据库服务脚本实现开机自动启动cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
5. Edit database service scripts to autostart cp/usr/local/mysql/support-files/mysql.server/etc/rc.d/init.d/mysqld
使用ss -tnl查看3306端口是不是开启
Use ss-tnl to see if port 3306 is open.
6.修改服务启动路径,防止找不到mysqld服务的路径7.测试一下MariaDB是不是可以使用
7. Test if MariaDB can be used.
给MariaDB添加默认用户密码,然后使用密码登录:
Add a default user password to MariaDB and then log in using the password:
> SET PASSWORD FOR 'root'@'localhost'=PASSWORD ('123456')
> exit
# mysql -uroot -h227.0.0.1 -p123456
>会提示登录成功
> Reminds login successful
五、编译安装php-5.4.40为httpd的模块
& nbsp; & nbsp; v. development and installation of php-5.4.40 to httpd module
1.解决依赖关系:
Addressing dependency:
#yum -y groupinstall "Desktop Platform Development"
#yum -y install bzip2-devel libmcrypt-devel
2.编译安装php-5.5.40
2. Compilation and installation of php-5.5.40
下载php-5.4.40.tar.bz2
& nbsp; & nbsp; downloading php-5.40.tar.bz2
# tar xf php-5.4.40.tar.bz2
# cd php-5.4.40
# http://gdruijie.cn/article/configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts
# make && make install
为php提供配置文件:
& nbsp; & nbsp; profile for php:
#cp php.ini-production /etc/php/php.ini
3.编辑apache配置文件httpd.conf,实现支持php格式显示网页
3. Edit the apache profile httpd.conf to achieve support for php format display page
# vim /etc/httpd/httpd.conf
(1)添加如下二行
& nbsp; (1) Add the following two lines:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
(2)定位至DirectoryIndex index.html
& nbsp; (2) locate to DirectoryIndex index.html
修改为:
& nbsp; & nbsp; Amend to read:
DirectoryIndex index.php index.html
(3)添加index.php主页
& nbsp;(3) Add index.php homepage
#vim /vhosts/b.org/html/index.php 添加内容如下
& nbsp; & nbsp; #vim/vhosts/b.org/html/index.php
$link=mysql_connect('127.0.0.1','root','123456');
if ($link)
echo "OK";
else
echo "Failure";
mysql_close();
?>
而后重新启动httpd,或让其重新载入配置文件即可测试php是否已经可以正常使用。
Then restarting httpd, or reloading it into the configuration file, will test if php is already functional.
六、在b.org站点下安装使用phpMyAdmin
& nbsp;vi. Installation of phpMyAdmin under site b.org
1、下载安装包phpMyAdmin-4.0.5-all-languages.zip
& nbsp;1 Download installation package phpMyAdmin-4.0.5-all-languages.zip
2、解压缩至/vhosts/b.org/html/pma
& nbsp;2, uncompressed to /vhosts/b.org/html/pma
# unzip phpMyAdmin-4.0.5-all-languages.zip
# mv phpMyAdmin-4.0.5-all-languages /vhosts/b.org/html/pma
3、测试站点可不可以访问
& nbsp;3, test sites accessible
七、在a.com站点下安装使用drupal
VII. Installation of drupal under a.com site
1、下载安装包至家目录
& nbsp;1 Download installation package to home directory
# mv Discuz_X3.2_SC_UTF8.zip /vhosts/a.com/html/
# cd /vhosts/a.com/html/
# unzip Discuz_X3.2_SC_UTF8.zip
2、在浏览器输入172.16.13.20/upload
& nbsp;2 Enter 172.16.13.20/upload on browser
八、安装xcache,为php加速
VIII. Installation of xcache to accelerate php
1、安装xcache
1. Installation of xcache
# tar xf xcache-3.0.3.tar.gz
# cd xcache-3.0.3
# /usr/local/php/bin/phpize (使用php自带的phpize命令使扩展的xcache模块可以编译进行)
& nbsp; & nbsp; #/usr/local/php/bin/phpize & nbsp; (extended xcache modules can be compiled using php-banded php commands)
# http://gdruijie.cn/article/configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
# make && make install
安装结束时,会出现类似如下行:
At the end of the installation, the following lines would appear:
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20100525/
2、编辑php.ini,整合php和xcache:
2 Edited php.ini, integrating php and xcache:
首先将xcache提供的样例配置导入php.ini
& nbsp; & nbsp; & nbsp; & first import samples from xcache into php.ini
# mkdir /etc/php.d
# cp xcache.ini /etc/php.d
接下来编辑/etc/php.d/xcache.ini,找到extension开头的行,修改为如下行:
Next, edit/etc/php.d/xcache.ini, find the line at the beginning of the Extension and amend it to read as follows:
extension=/usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so
注意:如果php.ini文件中有多条extension指令行,要确保此新增的行排在第一位。
N.B. If php.ini has several directives, make sure that this new line is ranked first.
3、使用ab命令测试php网页速度
3. Test php web speed with aab command
ab -n 1000 -c 500 https://172.16.13.21/pma/index.php
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享文章:httpd+MariaDB+php模块方式编译-创新互联
文章路径:http://gdruijie.cn/article/jgdoo.html
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论