要求:
vhost1: pma.stuX.com, phpMyAdmin, 同时提供https服务; vhost2: wp.stuX.com, wordpress vhost3: dz.stuX.com, Discuz
环境说明: DNS是:192.168.100.7 vhosts(Centos7):192.168.100.100 测试电脑是:192.168.100.1,DNS指定192.168.100.7
一、编译安装bind9
先创建一个系统帐号useradd -r named (gruoadd -g 53 named; useradd -u 53 -g named named -r ) ./configure --prefix=/usr/local/bind9 --sysyconfdir=/etc/named --disable-ipv6 --disablie-chroot --enable-threads make make install 编辑PATH export PATH=/usr/local/bind9/bin:/usr/local/bind/sbin:$PATH---->创建一个文件在,在/etc/profile.d目录下 vim /etc/ld.so.conf.d/named.conf ---->/usr/local/bind9/lib 编辑库文件 ldconfig -v 导出库文件 ln -sv /usr/local/bin9/inclue /usr/include/named 头文件 vim /etc/man.config---->MANPATH /usr/local/bind9/share/man 导出帮助搜索路径 vim /etc/named.conf主配置文件 创建/var/named目录的各文件:named.ca named.localhost named.loopback
完成后使用named -u -f -g -d 3启动named服务,并显示调试信息
二、 在centos7上检查lamp环境
测试PHP与mraiadb的连通性
三、创建httpd的虚拟机
在主配置文件/etc/httpd/conf/httpd.conf中最后插一行,指定虚拟机的配置文件及路径
虚拟机的配置如下:
虚拟机的index.html如下:
[root@localhost www]# cat vhost1/index.html vhost2/index.html vhost3/index.html welocomm to pma.stux.com welcomm to wp.stux.com welcomm to dz.stux.com [root@localhost www]#
测试虚拟机
四 pma.stux.com启用https,并使用phpmyadmin管理数据库
centos6(192.168.100.7)做为ca,centos7(192.168.100.100)将向centos6申请签证证书
centos6(192.168.100.7)上关于的CA的配置: (umask 077;openssl genrsa -out /etc/pki/CA/privaite/cakey.pem 2048) 生成密钥 openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -days 300 -out /etc/pki/CA/cacert.pem 自签密钥 touch /etc/pki/CA/index.txt echo 01 > serial
centos7的密钥配置:
(umask 077;openssl genrsa -out /mnt/pma.stux.com.key 2048) openssl req -new -key /mnt/pma.stux.com -days 300 -out /mnt/pma.stux.com.csr
把centos 7上的pma.stux.com.csr传给CA服务器(centos6),并进行签证
传给centos6可以使用scp命令 scp /mnt/pma.stux.com.csr 192.168.100.7:/mnt centos6签证 openssl ca -in /mnt/pma.stux.com.csr /mnt -days 300 -out /mnt/pma.stux.com.crt scp /mnt/pma.stux.com.crt 192.168.100.100:/mnt
centos7检查mod_ssl模块是否已安装
centos7上启用配置ssl
把/mnt目录下的pma.stux.com.key pma.stux.com.csr pma.stux.crt移动的/etc/httpd/ssl目录下
修改/etc/httpd/con.d/ssl.conf配置
使用httpd -t 检查配置,并重启httpd服务
[root@localhost conf.d]# httpd -t AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this messageSyntax OK [root@localhost conf.d]#
测试
五、把vhost2:wp.stux.com目录安装wordpress
检查mariadb是否版本及启动服务
检查php的版本
[root@localhost ~]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 19 Server version: 5.5.44-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> UPDATE mysql.user SET Password = password('123456') where User='root'; \\修改mysql的root密码是123456 Query OK, 4 rows affected (0.00 sec) Rows matched: 4 Changed: 4 Warnings: 0 MariaDB [(none)]> CREATE DATABASE wordpress; \\创建wordpress库 Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> SHOW DATABASES -> ; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | | wordpress | +--------------------+ 5 rows in set (0.00 sec) MariaDB [(none)]> GRANT ALL ON wrodpress.* TO 'root'@'localhost' IDENTIFIED BY '123456'; \\以root用户连接数据库 MariaDB [(none)]> GRANT ALL ON wrodpress.* TO 'root'@'localhost' IDENTIFIED BY '123456' MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> EXIT Bye
下载wordpress、解压,并把解压后的文件复制到/www/vhost2目录下
修改wp-config-sample.php为wp-config,并修改
cp wp-config-sample.php wp-config.php
打开wp.stux.com/wp-config.php
六、在vhost3(dz.stux.com)安装Discuz
下载 Discuz并解压,完成后文件复制到/www/vhost3
在浏览器上打开dz.stux.com/reload/install.php
把upload目录下的/config/、/data/、/uc_client/data、/uc_server/data权限设置为777,否则安装是提示错误
原创文章,作者:Net20-deamon,如若转载,请注明出处:http://www.178linux.com/21347