LAMP的环境原理 wordpress 搭建流程

小白入门,简单介绍LAMP的什么以及工作方式。

LAMP的环境原理

LAMP:是由Linux、Apache(httpd)、MySQL/MariaDB和PHP/Perl/Python这些开源软件所搭建起来的web应用平台。平台主机可以是独立的也可以在一台主机上

image

访问流程:客户端访问web服务,web服务器遵循二八法则直接将大部分静态访问资源反馈给客户,如果是动态资源则通过FastCGI协议调用php程序获取数据库的数据处理成为静态资源在返回给客户。

LAMP:web平台的搭配:

web服务器 脚本 数据库
httpd / nginx PHP:fpm Mysql
jsp:tomcat MariaDB
Python:Django
ruby:ror

使用一台主机搭建 wordpress博客

1、安装web服务器(httpd)

  1. [root@ ~]# yum -y install httpd
  2. 配置:
  3. [root@ ~]# vim /etc/httpd/conf/httpd.conf
  4. ServerName www.example.com:80 去掉注释
  5. [root@ ~]# httpd -t 检查语法错误
  6. [root@ ~]# systemctl start httpd.service 启动服务
  7. [root@ ~]# ss -tnl 查看端口
  8. State Recv-Q Send-Q Local Address:Port Peer Address:Port
  9. LISTEN 0 128 *:80 *:*
  10. LISTEN 0 128 *:22 *:*

2、安装脚本php-fpm

  1. [root@ ~]# yum -y install php

3、安装数据库,创建数据库 wordpress,用户名 admin,密码 admin

  1. [root@ ~]# yum -y install mariadb-server
  2. [root@ ~]# mysql
  3. ...
  4. ...
  5. MariaDB [(none)]> GRANT ALL ON wordpress.* TO 'admin'@'%' IDENTIFIED BY 'admin';
  6. MariaDB [(none)]>exit
  7. Bye
创建格式:GRANT ALL ON wordpress.* ‘user’@’IP’ IDENTIFIED BY ‘password’

IP域限制例如172.16.%.% ,172.16.1.% ;

测试:

  1. [root@ ~]# mysql -uadmin -h192.168.1.2 -padmin
  2. Welcome to the MariaDB monitor. Commands end with ; or \g.
  3. Your MariaDB connection id is 3
  4. Server version: 5.5.56-MariaDB MariaDB Server
  5. Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
  6. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  7. MariaDB [(none)]> exit
  8. Bye

4、安装扩展php-mysql

  1. [root@ ~]# yum -y install php-mysql

5、配置安装 wordpress

1、wordpress博客是一个动态资源站点,当客户端访问时需要通过脚本服务器的php-fpm脚本来进行数据处理实现用户与站点的交互。

服务器环境要求
* PHP 5.2.4或更新版本
* MySQL 5.0或更新版本
* Apache mod_rewrite模块(可选,用于支持“固定链接”和“站点网络”功能)

  1. [root@ ~]# mkdir /wordpress
  2. [root@ ~]# cd /wordpress
  3. [root@ ~]# wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.zip
  4. [root@ ~]# unzip wordpress-4.9.4-zh_CN.zip
  5. [root@ ~]# cp -a wordpress /var/www/html/blog
  6. [root@ ~]# cd /var/www/html/blog
  7. [root@ ~]# cp wp-config-sample.php wp-config.php
  8. [root@ ~]# vim wp-config.php
  9. // ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
  10. /** WordPress数据库的名称 */
  11. define('DB_NAME', 'wordpress');
  12. /** MySQL数据库用户名 */
  13. define('DB_USER', 'admin');
  14. /** MySQL数据库密码 */
  15. define('DB_PASSWORD', 'admin');
  16. /** MySQL主机 */
  17. define('DB_HOST', '192.168.1.2');

6、浏览器打开进行安装配置即可

  • 登录主页:192.168.1.2/blog
  • 登录后台:192.168.1.2/blog/wp-login.php
注意:跳过域名解析 -如果服务器设置了域名解析,修改配置文件
  1. [root@ ~]# vim /etc/my.cnf.d/server.cnf
  2. 添加一项:
  3. skip-name-resolve=ON 跳过主机名解析。

关闭SELinux

  1. [root@localhost blog]# setenforce 0
  2. [root@localhost blog]# getenforce
  3. Permissive

马哥笔记 网络资料 网络资料2 网络资料3 百度百科 网络资料4 php-fpm是什么

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/101646

(2)
N28_刚好遇到小熊猫N28_刚好遇到小熊猫
上一篇 2018-06-24 23:32
下一篇 2018-06-25 08:50

相关推荐

  • 第四周课程总结

    sed高级编辑命令模式空间相当于正在处理数据的这块空间保持空间相当于仓库,临时存放暂时没有处理完的半成品的空间P(大写):打印模式空间开端至\n内容,并追加到默认输出之前(即只打印第一行)h: 把模式空间中的内容覆盖至保持空间中H:把模式空间中的内容追加至保持空间中g: 从保持空间取出数据覆盖至模式空间G:从保持空间取出内容追加至模式空间x: 把模式空间中的…

    Linux笔记 2018-04-22
  • Linux的tail 与head 命令

    head命令是用来查看具体文件的前面几行的内容,具体格式如下: head <filename>: 你可以通过head命令查看具体文件最初的几行内容,该命令默认是前10行内容,如果你想查看前面更多内容,你可以通过一个数字选项来设置,例如 head -20 install.log 通过上面命令你可以查看install.log这个文件前面20行的内容 …

    2018-04-16
  • 第一周博客(4)

    基础命令

    Linux笔记 2018-05-12
  • MySQL用户和权限管理

    MySQL用户和权限管理

    2018-06-15
  • 计算机原理与Linux基础

    计算机的组成及功能 1、其实计算机的组织分为内部设备和外部设备, 内部设备:         CPU:运算器、寄存器、缓存         存储器:内存,RAM(Random Access Memory)         控制器:控制器是整个计算机系统的控制中心,它指挥计算机各部分协调地工作,保证计算机按照预先规定的目标和步骤有条不紊地进行操作及处理。 外部…

    Linux笔记 2018-05-13
  • centos7 网络设定

    从CentOS7开始,网络设定可以不再通过修改各类配置文件,而使用近乎万能的nmcli命令。本文简单介绍该命令的重要使用方法,为后期查询复习做记录。

    Linux笔记 2018-06-12