微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

快速部署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           |
+--------------------+
| @R_814_4045@ion_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 ~]#


  • 看到PHPinfo的页面后,就表示你的linux + apache + MysqL + PHP这个黄金架构环境,搭建好了

  • 你就可以在此环境上,来运行其他的代码了。

  • 你公司的PHP代码

  • 教大家部署一个论坛。

 

 

 

部署一个论坛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/*


 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐