通过LAMP部署phpMyAdmin、wordpress(https)、discuz

自作多情 提交于 2019-12-05 12:02:49

1、安装启动LAMP

安装环境:

  CentOS Linux release 7.5.1804

安装包:

  # yum -y install httpd php php-mysql mariadb-server

启动服务:

  systemctl start mariadb

  systemctl start httpd

 

2、部署phpMyAdmin

1、配置虚拟主机
# vim /etc/httpd/conf/httpd.conf  ,在文件的末尾加上下面配置信息
<VirtualHost *:80>
    ServerName pma.ysu.com
    DocumentRoot "/var/www/html/pma"
        CustomLog logs/pma_log combined
        <Directory "/var/www/html/pma">
            Require all granted
        </Directory>
</VirtualHost># systemctl restart httpd
2、上传phpMyAdmin-v4.4.14.1.zip安装包
# unzip phpMyAdmin-v4.4.14.1.zip
# mv phpMyAdmin-4.4.14.1-all-languages /var/www/html/pma
# chown -R apache:apache /var/www/html/pma/
# yum install php-mbstring
# systemctl restart httpd
3、修改phpMyAdmin的配置文件# cd /var/www/html/pma/
# mv config.sample.inc.php config.inc.php 
# vim config.inc.php
    $cfg['blowfish_secret'] = 'ky0yK9JwZpVvDspknLUw'; #填入随机字符串,类似加密
    $cfg['Servers'][$i]['host'] = '192.168.156.200';  #填入数据库地址4、访问网站测试 修改windows的hosts文件,添加服务器的解析  C:\Windows\System32\drivers\etc\hosts访问http://pma.ysu.com,进行测试

 

3、部署wordpress(https)

一、创建私有CA
1、生成密钥对儿
# cd /etc/pki/CA
# (umask 077;openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048)
2、生成自签证书:
  # openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 3655
填写证书信息
Country Name (2 letter code) [XX]:cn
State or Province Name (full name) []:Beijing
Locality Name (eg, city) [Default City]:Beijing
Organization Name (eg, company) [Default Company Ltd]:  #不填直接回车
Organizational Unit Name (eg, section) []:#不填直接回车
Common Name (eg, your name or your server's hostname) []:ca.ysu.com
Email Address []:#不填直接回车
3、/etc/pki/CA目录下创建需要的文件:
# touch index.txt serial crlnumber
# echo 01 > serial
    
二、客户端用openssl实现证书的申请:
1、在客户服务器上生成密钥,保存至应用此证书的服务的配置文件目录下:
# mkdir /etc/httpd/ssl
# cd /etc/httpd/ssl
# (umask 077; openssl genrsa -out httpd.key 1024)

2、生成证书签署请求:
# openssl req -new -key httpd.key -out httpd.csr

填写申请信息
Country Name (2 letter code) [XX]:cn
State or Province Name (full name) []:Beijing
Locality Name (eg, city) [Default City]:Beijing
Organization Name (eg, company) [Default Company Ltd]: #不填直接回车
Organizational Unit Name (eg, section) []:#不填直接回车
Common Name (eg, your name or your server's hostname) []:wp.ysu.com #此处必须和访问网址域名一致
 Email Address []:#不填直接回车
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:#不填直接回车
An optional company name []:#不填直接回车
3、将csr发送到CA服务器,因为这里客户端是CA服务器是同一个机器,省略此步骤

三、CA签署证书:
1、服务器上签署:
openssl ca -in /etc/httpd/ssl/httpd.csr -out /etc/httpd/ssl/httpd.crt -days 365


四、配置虚拟主机
# vim /etc/httpd/conf/httpd.conf  ,在文件的末尾加上下面配置信息
Listen 443
<VirtualHost *:443>
    ServerName wp.ysu.com
    DocumentRoot "/var/www/html/wordpress"
        CustomLog logs/wp_log combined
        <Directory "/var/www/html/wordpress">
            Require all granted
        </Directory>
        SSLEngine on
        SSLProtocol all -SSLv2
        SSLCipherSuite DEFAULT:!EXP:!SSLv2:!DES:!IDEA:!SEED:+3DES
        SSLCertificateFile /etc/httpd/ssl/httpd.crt
        SSLCertificateKeyFile /etc/httpd/ssl/httpd.key
</VirtualHost># systemctl restart httpd五、配置wordpress

上传wordpress-4.9.4-zh_CN.zip
# unzip wordpress-4.9.4-zh_CN.zip
# mv wordpress /var/www/html/
# chow -R apache:apache /var/www/html/wordpress

创建数据库
mysql > CREATE DATABASE wp CHARACTER SET = utf8;

创建管理wp数据库的用户
mysql > GRANT ALL ON wp.* TO wp@localhost IDENTIFIED BY '111111';

修改wordpress配置文件
# cd /var/www/html/wordpress
# mv wp-config-sample.php wp-config.php  
# vim wp-config.php
修改如下字段
define('DB_NAME', 'wp');
define('DB_USER', 'wp');
define('DB_PASSWORD', '111111');
六、访问网站测试 修改windows的hosts文件,添加服务器的解析  C:\Windows\System32\drivers\etc\hosts访问https://wp.ysu.com,进行测试

 

4、部署discuz

 

1、配置虚拟主机
# vim /etc/httpd/conf/httpd.conf  ,在文件的末尾加上下面配置信息
<VirtualHost *:80>
    ServerName dz.ysu.com
    DocumentRoot "/var/www/html/dz/upload"
        CustomLog logs/dz_log combined
        <Directory "/var/www/html/dz/upload">
            Require all granted
        </Directory>
</VirtualHost>
# systemctl restart httpd
2、上传程序文件ComsenzDiscuz-DiscuzX-master.zip # unzip ComsenzDiscuz-DiscuzX-master.zip # mv DiscuzX /var/www/html/dz # chown -R apache:apache /var/www/html/dz


3、创建数据库
mysql > CREATE DATABASE dz;
mysql > CREATE USER 'dz'@'localhost';
mysql > GRANT ALL PRIVILEGES ON dz.* TO 'dz'@'localhost' IDENTIFIED BY '123456';


六、访问网站测试 修改windows的hosts文件,添加服务器的解析  C:\Windows\System32\drivers\etc\hosts访问http://dz.ysu.com,进行测试

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!