Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

栏目: 数据库 · Mysql · 发布时间: 8年前

内容简介:Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

Centos6实现基于虚拟主机的各应用程序搭建:

一、配置三个基于名称的虚拟主机;

虚拟主机一、 discuzX

虚拟主机二、 wordpress

虚拟主机三、 https: phpMyAdmin

1.安装lamp:

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

2.配置a、b基于FQDN的虚拟主机

(1)关闭中心主机:

#vim /etc/httpd/conf/httpd.conf 
  #DocumentRoot "/var/www/html"

(2)创建虚拟主机:

#vim /etc/httpd/conf.d/vhost.conf 
NameVirtualHost *:80
<VirtualHost *:80>
    ServerName www.li1.com
    DocumentRoot "/var/www1/html"
</VirtualHost>
<VirtualHost *:80>
    ServerName www.li2.com
    DocumentRoot "/var/www2/html"
</VirtualHost>

(3)创建目录:

# mkdir /var/www{1,2}/html
  # echo "www.li1.com" > /var/www1/html/index.html
  # echo "www.li2.com" > /var/www2/html/index.html

3.创建c基于FQDN的虚拟主机

(1)安装ssl模块

  # yum install -y mod_ssl

(2)搭建ssl:④

   ①搭建Server私有CA:

#(openssl 077;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
  #echo 01 > /etc/pki/CA/serial

   ②搭建httpd证书文件:

    # mkdir /var/www3/ssl
  #(openssl 077;openssl genrsa -out /var/www3/ssl/httpd.key 2048)
  #openssl req -new  -key /var/www3/ssl/httpd.key -out /var/www3/ssl/httpd.csr

   ③授权httpd证书:

openssl ca -in /var/www3/ssl/httpd.csr -out /etc/pki/CA/httpd.crt -days 3655

(3)创建虚拟机

[root@Centos html]# vim /etc/httpd/conf.d/ssl.conf
## SSL Virtual Host Context
<VirtualHost _default_:443>
DocumentRoot "/var/www3/html"
ServerName www.li3.com:443
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite DEFAULT:!EXP:!SSLv2:!DES:!IDEA:!SEED:+3DES
SSLCertificateFile /var/www3/ssl/httpd.crt
SSLCertificateKeyFile /var/www3/ssl/httpd.key
    </VirtualHost>

(4)创建目录:

# mkdir /var/www3/html
# echo "www.li3.com" > /var/www3/html/index.html

4.启动 mysql 服务创建授权用户及数据库

#service mysqld start
 #mysql
   mysql> GRANT ALL ON *.* testdb.* to li@'%' IDENTIFIED BY '123';
   mysql> CREATE DATABASE testdb;
   mysql> CREATE TABLE tab1;
   mysql> FLUSH PRIVILEGES;

5.运行mysql安全设置命令

    mysql_secure_installtion

6.下载程序包:①DiscuzX ②wordpress ③phpMyAdmin

7.解压安装Discuz程序

①解压程序包

   # unzip Discuz_X3.2_SC_UTF8.zip

②更改upload目录属主

   #chown -R apache upload/

③使用浏览器输入 http://www.li1.com/upload 进行安装Discuz论坛

注意:这里没有配置FQDN解析服务,需要在访问端更改hosts文件将 www.li1.com 指向ip:10.1.1.25

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

④设置目录权限

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

⑤选择安装方法 Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

⑥输出数据库信息

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

⑦安装进行中

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序 ⑧安装成功

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

8.解压安装WorldPress程序

①解压程序包

# unzip wordpress-4.3.1-zh_CN.zip

②修改wordpress/wp-config-sample.php 文件将数据库相关信息更改

[root@Centos html]# vim wordpress/wp-config-sample.php 
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');
 
/** MySQL数据库用户名 */
define('DB_USER', 'li');
 
/** MySQL数据库密码 */
define('DB_PASSWORD', '123');
 
/** MySQL主机 */
define('DB_HOST', '10.1.1.25');

③在浏览器中输出主机地址加解压出来的目录名称进行安装

[root@Centos html]# ls
 index.html  wordpress  wordpress-4.3.1-zh_CN.zip[object Object]

④填写数据库信息

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

⑤点击进行安装

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

⑥填写站点信息进行安装

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

⑦安装完成

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序 ⑧测试登录

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序 ⑨测试成功

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

9.解压安装PhpMyAdmin程序

①.下载phpMyAdmin软件包到文档根目录

②.创建link

    # ln -sv phpMyAdmin… pma

③.cd pma

④.mv config.sample.inc.php config.inc.php

⑤ vim config.inc.php

生成秘钥,用于加固:# openssl rand -base64 15

   gN+/3gQ2UNr8QYmmRBgd

生成出来的秘钥添加到:   $cfg[‘blowfish_secret’] = ‘here’

[root@Centos pma]# vim config.inc.php

$cfg[‘blowfish_secret’] = ‘gN+/3gQ2UNr8QYmmRBgd’; /*

⑥.安装支持多字节字符串扩展的程序包:

    yum install -y php-mbstring

⑦.启动httpd服务

    systemctl start httpd

⑧、访问: https://www.li3.com/pma

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

二、对discuzX的主页做压测;

1.分别给出并发10, 100, 200, 500等每秒的响应数;请求数统一为10000;

Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序

结论:当并发数越低每秒处理的请求就越高,因为cpu在任务少的利用率越高,任务多时CPU消耗严重,处理请求速度慢


以上所述就是小编给大家介绍的《Centos6基于虚拟主机的Lamp配置bbs、Blog、PhpMyAdmin应用程序》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Dive Into Python 3

Dive Into Python 3

Mark Pilgrim / Apress / 2009-11-6 / USD 44.99

Mark Pilgrim's Dive Into Python 3 is a hands-on guide to Python 3 (the latest version of the Python language) and its differences from Python 2. As in the original book, Dive Into Python, each chapter......一起来看看 《Dive Into Python 3》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

SHA 加密
SHA 加密

SHA 加密工具