其他分享
首页 > 其他分享> > 快速部署LAMP黄金架构,搭建disuz论坛

快速部署LAMP黄金架构,搭建disuz论坛

作者:互联网

快速部署LAMP架构

[root@zhanghuan ~]# iptables -F
[root@zhanghuan ~]# systemctl stop firewalld
[root@zhanghuan ~]# systemctl disable firewalld
[root@zhanghuan ~]# getenforce
Disabled

# 停止,以及把nginx应用程序卸载了
[root@zhanghuan yum.repos.d]# yum remove nginx -y

# 安装apache 这个web服务器,应用程序
[root@zhanghuan yum.repos.d]# yum install httpd
Loaded plugins: fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Package httpd-2.4.6-97.el7.centos.x86_64 already installed and latest version
Nothing to do


# 启动apache
systemctl start httpd

[root@zhanghuan yum.repos.d]# netstat -tunlp|grep httpd
tcp6       0      0 :::80                   :::*                   LISTEN      3633/httpd
tcp6       0      0 :::443                 :::*                   LISTEN      3633/httpd


部署mysql


# yum 安装即可
# 安装
yum install mariadb-server mariadb -y
# 启动
[root@zhanghuan yum.repos.d]# systemctl start mariadb
# 验证mysql,默认的服务窗口,端口port,3306
[root@zhanghuan yum.repos.d]# netstat -tunlp | grep "mysql"
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      3965/mysqld

# 使用,访问
# 了解基本的sql语句
[root@zhanghuan yum.repos.d]# mysql   -uroot   -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-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)]>
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql             |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]> use mysql;

# 查询user表的信息(转化思想去理解。这个mysql文件夹下,有一个名为user的excel表格)
# mysql专业的查询语句

MariaDB [mysql]> select user,password,host from user;
+------+----------+-----------+
| user | password | host     |
+------+----------+-----------+
| root |         | localhost |
| root |         | ceph     |
| root |         | 127.0.0.1 |
| root |         | ::1       |
|     |         | localhost |
|     |         | ceph     |
+------+----------+-----------+
6 rows in set (0.00 sec)

MariaDB [mysql]> exit
Bye

部署php结合apache


1.解决php安装的依赖开发环境
yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libtool-ltdl-devel pcre pcre-devel apr apr-devel zlib-devel gcc make

2.安装php,以及php连接mysql数据库的驱动
[root@zhanghuan ~]# yum install php php-fpm php-mysql -y


3.php不需要额外修改,但是需要修改apache配置文件,支持php的脚本读取即可

# php程序和apache结合工作

4.编辑apache配置文件
vim /etc/httpd/conf/httpd.conf

5.进行配置文件修改
# 使用vim,显示行号 :set nu
# 在120行左右这里,添加如下配置

119 DocumentRoot "/var/www/html"
120     TypesConfig /etc/mime.types
121     AddType application/x-httpd-php .php
122     AddType application/x-httpd-php-source .phps
123     DirectoryIndex index.php index.html


6.编写一个php的脚本,看apache是否能正确加载读取
# 这个脚本需要放置在如下位置
vim /var/www/html/index.php
<meta charset=utf8>
我是新的首页,你好兄弟们
<?php
phpinfo();
?>

7.重启apache
[root@zhanghuan ~]# systemctl restart httpd
[root@zhanghuan ~]#


 

 

 

部署一个论坛disuz


# 下载论坛的压缩代码
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip

# 2.解压缩代码包,使用解压命令 unzip
yum install unzip -y

# 3.解压缩

# 4.拷贝upload代码到apache目录下,即可访问
[root@zhanghuan discuz]# cp -r upload/* /var/www/html/
cp: overwrite ‘/var/www/html/index.php’? y

# 5.修改代码权限
[root@zhanghuan discuz]# chmod -R 777 /var/www/html/*


 

标签:架构,root,devel,LAMP,zhanghuan,yum,mysql,php,disuz
来源: https://www.cnblogs.com/zhang-huan/p/16243788.html