LAMP架构概述+搭建论坛平台

1.LAMP动态网站架构组成

lamp的全称是linux+apache+mysql+php

apache 主要实现如下功能:
第一:处理 http 的请求、构建响应报文等自身服务;
第二:配置让 Apache 支持 PHP 程序的响应(通过 PHP 模块或 FPM );
第三:配置 Apache 具体处理 php 程序的方法,如通过反向代理将 php 程序交给 fcgi 处理。
php 主要实现如下功能:
第一:提供 apache 的访问接口,即 CGI Fast CGI(FPM);
第二:提供 PHP 程序的解释器; 2. RPM 包搭建 LAMP 架构
1. RPM 搭建 LAMP 所需软件包
Centos yum 安装保存 rpm 到本地
1. 修改 yum 配置文件
2. 清理 yum 缓存
3.yum 安装
4. 下载 rpm 包到本地
2. 开启 mysql 服务
第三:提供 mysql/mairadb 数据库的连接函数的基本环境。
mysql 主要实现如下功能:
第一:提供 PHP 程序对数据的存储;
第二:提供 PHP 程序对数据的读取 ( 通常情况下从性能的角度考虑,尽量实现数据库的读写分离 )
由此可知,要实现 LAMP 在配置每一个服务时,安装功能需求进行配置,即可实现 LAMP 的架构,当然 apache
mysql php 服务都可配置为独立服务,安装在不同服务器之上。
 

2. RPM包搭建LAMP架构 


完毕!
[root@localhost ~]# yum install mysql mysql-server php php-mysql php-fpm  -y  
[root@localhost ~]# yum install mariadb mariadb-server  #因为用的是Centos 所以需要安装mariadb
[root@localhost ~]#ststemctl start mariadb
[root@localhost ~]#mysql  #初始是没有密码 可以直接登录
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)]>

 2.配置Apache支持php

[root@localhost ~]# vim /etc/httpd/conf/httpd.conf#
执行 /DircetoryIndex 
<IfModule dir_module>
    DirectoryIndex index.html index.php#支持php
</IfModule>
执行 /AddType
可以yy 复制一行 p粘贴
    #AddType application/x-gzip .tgz  
    AddType application/x-httpd-php .php# 支持php应用
 
[root@localhost ~]# cd /var/www/html/ #默认根目录
[root@localhost html]# ls
index.html
[root@localhost html]# vim index.php #创建php测试页

<?php
phpinfo();
?>
[root@localhost ~]#systemctl restart httpd

 3,安装配置Discuz 论坛

[root@localhost ~]# yum install unzip
[root@localhost ~]# unzip Discuz_X3.4_SC_UTF8【20191201】.zip  #安装解压工具:
[root@localhost ~]# cp -a upload/* /var/www/html/
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# chmod -R 777 *    #增加可写权限
[root@localhost html]# ls -l
total 68
-rwxrwxrwx.  1 root root 2748 Dec  1  2019 admin.php
drwxrwxrwx. 10 root root  149 Dec  1  2019 api
-rwxrwxrwx.  1 root root  727 Dec  1  2019 api.php
drwxrwxrwx.  2 root root   23 Dec  1  2019 archiver
drwxrwxrwx.  2 root root   90 Dec  1  2019 config
-rwxrwxrwx.  1 root root 1017 Dec  1  2019 connect.php
-rwxrwxrwx.  1 root root  106 Dec  1  2019 crossdomain.xml
drwxrwxrwx. 12 root root  202 Dec  1  2019 data
-rwxrwxrwx.  1 root root 5558 Dec  1  2019 favicon.ico
-rwxrwxrwx.  1 root root 2245 Dec  1  2019 forum.php
-rwxrwxrwx.  1 root root  821 Dec  1  2019 group.php
-rwxrwxrwx.  1 root root 1280 Dec  1  2019 home.php
-rwxrwxrwx.  1 root root 5893 Dec  1  2019 index.php
drwxrwxrwx.  5 root root   64 Dec  1  2019 install
drwxrwxrwx.  2 root root   23 Dec  1  2019 m
-rwxrwxrwx.  1 root root 1025 Dec  1  2019 member.php
-rwxrwxrwx.  1 root root 2435 Dec  1  2019 misc.php
-rwxrwxrwx.  1 root root 1788 Dec  1  2019 plugin.php
-rwxrwxrwx.  1 root root  977 Dec  1  2019 portal.php
-rwxrwxrwx.  1 root root  582 Dec  1  2019 robots.txt
-rwxrwxrwx.  1 root root 1155 Dec  1  2019 search.php
drwxrwxrwx. 10 root root  168 Dec  1  2019 source
drwxrwxrwx.  7 root root   86 Dec  1  2019 static
drwxrwxrwx.  3 root root   38 Dec  1  2019 template
drwxrwxrwx.  7 root root  106 Dec  1  2019 uc_client
drwxrwxrwx. 13 root root  241 Dec  1  2019 uc_server
[root@localhost html]# 



 

 4.在这里博主遇到一个这样的问题

扫描二维码关注公众号,回复: 13465647 查看本文章

 1.这个提示呢一般都是以为权限没有给,但是我们已给过了

我们要直接一个getenforce查看当前的状态正常肯定就是Enforcing模式了

[root@localhost html]# cd /etc/selinux/ 就直接cd到selinxu下

[root@localhost selinux]# ls
config  final  semanage.conf  targeted  tmp
[root@localhost selinux]# vim config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing     #将enforcing 改成 permissive
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

[root@localhost selinux]# restorecon - Rv fil

[root@localhost selinux]# reboot #重启就好了

 4.创建数据库,连接数据库 ,这个空自己可以填

 

第一版忘记发出来,不小心删除了,这一版比较草率也够用了 

猜你喜欢

转载自blog.csdn.net/m0_52454621/article/details/117406404