基于LAMP环境发布一个Discuz论坛网站

一、LAMP是什么

1、LAMP是常见的Web服务器环境解决方案,用于创建和管理Web应用程序的开源开发平台。Linux用作后端操作系统,Apache是​​Web服务器,MySQL是数据库,PHP是脚本语言。

2、LAMP 为 Linux、Apache、MySQL、PHP 的简称,这是一个常规的 Web 服务器环境解决方案,使用其首字母缩写“LAMP”来引用。它是一个用于创建和管理 Web 应用程序的开源开发平台。Linux 用作后端操作系统(OS)。Apache 是​​Web 服务器,MySQL 是数据库,PHP 是脚本语言。

3、有些人认为 LAMP 是:Linux,Apache,MySQL 和 Perl / PHP / Python。换句话说,解决方案堆栈中的脚本语言可以是 Perl,PHP 或 Python。PHP 是最流行的脚本语言,因此,在实践中,LAMP 通常用于描述带有 PHP 语义的解决方案堆栈,主要思想是相同的–LAMP 是一个广泛使用的开源解决方案堆栈,被认为相对容易使用。

二、LAMP工作原理

在这里插入图片描述

Discuz简介

Discuz官网:https://www.discuz.net/forum.php

Crossday Discuz! Board(简称 Discuz!)是一套通用的社区论坛软件系统。自2001年6月面世以来,是全球成熟度最高、覆盖率最大的论坛软件系统之一。2010年8月23日,与腾讯达成收购协议 。

电子商务网站、论坛、博客、视频等等的动态网站中,都需要一个能够支持动态网站的web环境,LAMP环境是集合了Linux+Apache+Mysql+PHP,是一组常用来搭建动态网站或者服务器的开源软件,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台!

环境准备

准备一台Centos7服务器
系统: Centos7.3
内存:1G
cpu: 2核
IP地址: 10.0.0.45

安装相关组件

#安装阿帕奇服务
yum -y install httpd
#安装数据库服务、php服务
yum -y install mariadb mariadb-server php php-fpm php-mysql
#重启阿帕奇服务
systemctl restart httpd
#重启数据库服务
systemctl restart mariadb
#编辑阿帕奇配置文件
vim /etc/httpd/conf/httpd.conf 

配置Apache和PHP的整合

在这里插入图片描述

新建php的测试页面,测试Apahce和PHP的整合是否成功

#编辑阿帕奇服务配置文件
[root@ localhost ~]# vim /var/www/html/index.php
#编辑PHP测试页面
[root@ localhost ~]# cat /var/www/html/index.php 
<?php
phpinfo();
?>
#重启php、数据库、阿帕奇服务
 systemctl restart httpd mariadb php-fpm

测试php页面

在这里插入图片描述

上传论坛服务包并解压

在这里插入图片描述

#挂载论坛Discuz的镜像
[root@ localhost ~]# mount /dev/sr0 /media/
mount: /dev/sr0 is write-protected, mounting read-only
#查看镜像
[root@ localhost ~]# ll /media/
total 10660
-r-xr-xr-x 1 root root 10915668 2017-02-15 16:21 Discuz_X3.3_SC_UTF8.zip
[root@ localhost ~]# 
#挂载完把Discuz镜像拷贝到/usr/src目录下
[root@ localhost ~]# cp -r /media/Discuz_X3.3_SC_UTF8.zip /usr/src/
#切换到/usr/src目录下
[root@ localhost ~]# cd /usr/src/
[root@ localhost src]# ll
total 10660
drwxr-xr-x. 2 root root        6 2016-11-05 23:38 debug
-r-xr-xr-x  1 root root 10915668 2019-11-29 20:18 Discuz_X3.3_SC_UTF8.zip
drwxr-xr-x. 3 root root       35 2019-09-17 22:13 kernels
#解包
unzip Discuz_X3.3_SC_UTF8.zip 
#查看Discuz论坛包
[root@ localhost src]# ll
total 10664
drwxr-xr-x.  2 root root        6 2016-11-05 23:38 debug
-r-xr-xr-x   1 root root 10915668 2019-11-29 20:18 Discuz_X3.3_SC_UTF8.zip
drwxr-xr-x.  3 root root       35 2019-09-17 22:13 kernels
drwxr-xr-x   2 root root      102 2017-01-03 09:44 readme
drwxr-xr-x  12 root root     4096 2017-01-03 09:44 upload
drwxr-xr-x   4 root root       72 2017-01-03 09:44 utility
#拷贝解压出来的论坛到网站根目录下
cp -r /usr/src/upload/ /var/www/html/

浏览器访问

在这里插入图片描述

[root@ localhost upload]# cd /var/www/html/upload/
[root@ localhost upload]# ll
total 76
-rw-r--r--  1 root root 2739 2019-11-29 20:25 admin.php
drwxr-xr-x 11 root root  163 2019-11-29 20:25 api
-rw-r--r--  1 root root  727 2019-11-29 20:25 api.php
drwxr-xr-x  2 root root   23 2019-11-29 20:25 archiver
drwxr-xr-x  2 root root   90 2019-11-29 20:25 config
-rw-r--r--  1 root root  922 2019-11-29 20:25 connect.php
-rw-r--r--  1 root root  253 2019-11-29 20:25 cp.php
-rw-r--r--  1 root root  106 2019-11-29 20:25 crossdomain.xml
drwxr-xr-x 13 root root  216 2019-11-29 20:25 data
-rw-r--r--  1 root root 5558 2019-11-29 20:25 favicon.ico
-rw-r--r--  1 root root 2242 2019-11-29 20:25 forum.php
-rw-r--r--  1 root root  821 2019-11-29 20:25 group.php
-rw-r--r--  1 root root 1290 2019-11-29 20:25 home.php
-rw-r--r--  1 root root 5669 2019-11-29 20:25 index.php
drwxr-xr-x  5 root root   64 2019-11-29 20:25 install
-rw-r--r--  1 root root 1025 2019-11-29 20:25 member.php
-rw-r--r--  1 root root 2462 2019-11-29 20:25 misc.php
-rw-r--r--  1 root root 1757 2019-11-29 20:25 plugin.php
-rw-r--r--  1 root root  988 2019-11-29 20:25 portal.php
-rw-r--r--  1 root root  582 2019-11-29 20:25 robots.txt
-rw-r--r--  1 root root 1161 2019-11-29 20:25 search.php
drwxr-xr-x 10 root root  168 2019-11-29 20:25 source
drwxr-xr-x  6 root root   72 2019-11-29 20:25 static
drwxr-xr-x  3 root root   38 2019-11-29 20:25 template
drwxr-xr-x  7 root root  106 2019-11-29 20:25 uc_client
drwxr-xr-x 14 root root  256 2019-11-29 20:25 uc_server
-rw-r--r--  1 root root 1682 2019-11-29 20:25 userapp.php
#给论坛赋权限
chmod -R 777 /var/www/html/

在这里插入图片描述

#初始化数据库
[root@ localhost ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] 
New password: 
Re-enter new password: 
Sorry, you can't use an empty password here.

New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] no
 ... skipping.

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

登陆数据库

[root@ localhost ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
#创建数据库
MariaDB [(none)]> create database ultrax;
Query OK, 1 row affected (0.00 sec)

#授权
MariaDB [(none)]> grant all privileges on *.* to root@'localhost' identified by '123';
Query OK, 0 rows affected (0.01 sec)

#刷新权限
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit
Bye
[root@ localhost ~]# systemctl restart mariadb httpd php-fpm
[root@ localhost ~]# 

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

成功访问到论坛首页

在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值