搭建lamp安装部署wordpress-discuz-phpmyadmin

实验环境centos6.7

  1. 安装httpd:

yum install -y httpd

2.修改配置文件

注销配置文件/etc/httpd/conf/httpd.conf中的DocumentRoot

在/etc/httpd/conf.d目录下新建一个辅助配置文件vhost.conf

[root@bogon a.com]# cat /etc/httpd/conf.d/vhost.conf 
NameVirtualHost 192.168.1.110:80
<VirtualHost 192.168.1.110:80>
    ServerName www.a.com
    DocumentRoot "/www/a.com"
    <Directory "/www/a.com">
        Options FollowSymLinks
        Allowoverride None
    </Directory>
</VirtualHost>

<VirtualHost 192.168.1.110:80>
    ServerName www.b.net
    DocumentRoot "/www/b.net"
    <Directory "/www/b.net">
        Options FollowSymLinks
        Allowoverride None
    </Directory>
</VirtualHost>

<VirtualHost 192.168.1.110:80>
    ServerName www.c.org
    DocumentRoot "/www/c.org"
    <Directory "/www/c.org">
        Options FollowSymLinks
        Allowoverride None
    </Directory>
</VirtualHost>

3.创建DocumentRoot所需的目录

mkdir /www/{a.com,b.net,c.org}
[root@bogon a.com]# tree /www
/www
├── a.com
│   └── index.html
├── b.net
└── c.org

4.在a.com中创建一个index.html文件,内容自定义

[root@bogon a.com]# cat index.html 
<h1>www.a.com</h1>

5.注意,如果你想在window中测试apache服务,你需要在系统盘:\window\system32\drives\etc\hosts文件中添加以下三行,在Linux中的/etc/hosts文件中也是一样的

192.168.1.110 www.a.com
192.168.1.110 www.b.net
192.168.1.110 www.c.org

6.检测配置文件的语法问题,并开启服务

[root@bogon a.com]# httpd -t
httpd: apr_sockaddr_info_get() failed for bogon
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK
[root@bogon a.com]# service httpd status   #查看状态(service httpd start开启)
httpd (pid  2628) is running...
[root@bogon a.com]# ss -tnl    #查看端口是否被监听
State      Recv-Q Send-Q              Local Address:Port                Peer Address:Port 
LISTEN     0      128                             *:49222                          *:*     
LISTEN     0      128                            :::111                           :::*     
LISTEN     0      128                             *:111                            *:*     
LISTEN     0      128                            :::80                            :::*     
LISTEN     0      128                            :::48276                         :::*     
LISTEN     0      128                            :::22                            :::*     
LISTEN     0      128                             *:22                             *:*     
LISTEN     0      128                     127.0.0.1:631                            *:*     
LISTEN     0      128                           ::1:631                           :::*     
LISTEN     0      100                           ::1:25                            :::*     
LISTEN     0      100                     127.0.0.1:25                             *:*

7.在window中查看是否成功

搭建lamp安装部署wordpress-discuz-phpmyadmin_第1张图片

搭建lamp安装部署wordpress-discuz-phpmyadmin_第2张图片

8.安装php模块

yum install -y php

9.修改配置文件vhost.conf

[root@bogon a.com]# vim /etc/httpd/conf.d/vhost.conf 
[root@bogon a.com]# cat /etc/httpd/conf.d/vhost.conf
NameVirtualHost 192.168.1.110:80
DirectoryIndex index.php  #识别php文件  
<VirtualHost 192.168.1.110:80>
    ServerName www.a.com
    DocumentRoot "/www/a.com"
    <Directory "/www/a.com">
        Options FollowSymLinks
        Allowoverride None
    </Directory>
</VirtualHost>

<VirtualHost 192.168.1.110:80>
    ServerName www.b.net
    DocumentRoot "/www/b.net"
    <Directory "/www/b.net">
        Options FollowSymLinks
        Allowoverride None
    </Directory>
</VirtualHost>

<VirtualHost 192.168.1.110:80>
    ServerName www.c.org
    DocumentRoot "/www/c.org"
    <Directory "/www/c.org">
        Options FollowSymLinks
        Allowoverride None
    </Directory>
</VirtualHost>

在/www/c.org目录下创建一个index.php内容输出php的信息

[root@bogon c.org]# vim index.php
[root@bogon c.org]# cat index.php
<?php 
    phpinfo();
?>

检测配置文件语法以及重新加载httpd服务

[root@bogon c.org]# httpd -t
httpd: apr_sockaddr_info_get() failed for bogon
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK
[root@bogon c.org]# service httpd reload
Reloading httpd:

在浏览器中查看结果

结果就是什么不显示,因为我忘了安装一个php-devel的程序包了

[root@bogon c.org]# yum install -y php-devel
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.yun-idc.com
 * extras: mirrors.skyshe.cn
 * updates: mirror.oasis.onnetcorp.com
Resolving Dependencies
--> Running transaction check
---> Package php-devel.x86_64 0:5.3.3-46.el6_7.1 will be installed
--> Processing Dependency: automake for package: php-devel-5.3.3-46.el6_7.1.x86_64

再次访问www.c.org

搭建lamp安装部署wordpress-discuz-phpmyadmin_第3张图片这样就成功了

10,下面我们安装一些mysql,这是需要我们安装mysql的服务端的程序包,php-mysql的集成,

yum install -y mysql-server php-mysql

11.尝试开启mysql服务,以及远程授权连接mysql,因为部署个人博客系统需要远程连接数据库

[root@bogon c.org]# service mysqld start
Initializing MySQL database:  WARNING: The host 'bogon' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h bogon password 'new-password'
#注意,首次安装并且开启服务,给root创建[root@bogon bin]# mysqladmin -u root password "root"
一个访问密码,执行上面的其中一个命令
Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@bogon bin]# mysqladmin -u root password "root"  #创建一个简单的密码root

[root@bogon bin]# mysql         #需要使用密码才能登录
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@bogon bin]# ss -tnl | grep 3306    #查看数据库3306端口是否被监听
LISTEN     0      50                        *:3306                     *:*     
[root@bogon bin]# mysql -u root -p        使用密码登录
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
[root@bogon bin]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all privileges on *.* to 'root'@'192,168.%.%' identified by 'root'
    -> ;    #授权远程登录数据库
Query OK, 0 rows affected (0.00 sec)

mysql>

编写php连接数据库的测试文件

[root@bogon bin]# vim /www/b.net/index.php
[root@bogon bin]# cat /www/b.net/index.php
<?php
    $link=mysql_connect('192.168.1.110','root','root');
    if($link)
        echo "数据库连接成功";
    else
        echo "数据库连接失败";
?>

在/etc/php.ini中修改配置文件mysql段和mysqli段

mysql.default_port=3306
mysql.default_host=192.168.1.110
mysql.default_user=root
mysql.default_pw=root

在浏览器中测试结果

httpd -t
service mysqld reload
service httpd reload

搭建lamp安装部署wordpress-discuz-phpmyadmin_第4张图片

下载wordpress安装包

解压后将wordpress目录下的所有内容移到/www/a.com目录下

[root@bogon a.com]# ls
index.php        wp-blog-header.php    wp-cron.php        wp-mail.php
license.txt      wp-comments-post.php  wp-includes        wp-settings.php
readme.html      wp-config.php         wp-links-opml.php  wp-signup.php
wp-activate.php  wp-config-sample.php  wp-load.php        wp-trackback.php
wp-admin         wp-content            wp-login.php       xmlrpc.php

在浏览器中配置

搭建lamp安装部署wordpress-discuz-phpmyadmin_第5张图片

搭建lamp安装部署wordpress-discuz-phpmyadmin_第6张图片

搭建lamp安装部署wordpress-discuz-phpmyadmin_第7张图片

下面配置discuz

下载安装 解压缩 然后放在/www/b.net目录下

注意url:www.b.net/upload/

搭建lamp安装部署wordpress-discuz-phpmyadmin_第8张图片

搭建lamp安装部署wordpress-discuz-phpmyadmin_第9张图片

没有写入权限,因此我们需要修改文件的权限

[root@bogon upload]# chmod -R 777 ./*

刷新页面

搭建lamp安装部署wordpress-discuz-phpmyadmin_第10张图片

搭建lamp安装部署wordpress-discuz-phpmyadmin_第11张图片

配置phpmyadmin

和上面一样,下载解压缩,移到/www/c.org

wKioL1cqIYKjEhZGAAA4EleqGeQ812.jpg

yum install -y php-mbstring

搭建lamp安装部署wordpress-discuz-phpmyadmin_第12张图片

就完成了,登录的时候可能需要你升级mysql,你可以选择编译安装mysql,这里不再显示


你可能感兴趣的:(phpMyAdmin,wordpress,lamp,discuz)