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

相关推荐

  • 加密原理简述、实现httpd自签证书访问、dns主、辅服务器搭建及智能dns服务

    1、简述加密算法的原理 介于用户空间和内核空间之间有用于数据加密的协议,对来至用户空间的数据进行加密,并转交给内核空间发送至目标端,然后由目标端接收加密数据然后交付给加密协议解密后的数据显示给用户空间。当然数据也可不通过加密协议直接传送。 2、加密算法的分类: 对称加密:数据保密(保密性) 公钥加密:身份认证、密钥交换、数据加密(不常用,比对称要慢3个数量级…

    Linux笔记 2018-05-25
  • One

    编译器好难用T_T

    Linux笔记 2018-06-26
  • Linux的发行版

    按系列罗列Linux的发行版,并描述不同发行版之间的联系与区别。

    Linux笔记 2018-06-21
  • 磁盘存储和系统文件

    ll /dev/sd*查看硬盘设备ll dev/sda 8,0主要设备号和次要设备号mknod专门创建块文件 mknod /data/sda 8,1dd if=data/zerofile of=test bs=1M count=10hexdump -c test 查看里面lsblk查看硬盘名cenos6 加硬盘名字会变 7会自己排列head:磁头track:…

    Linux笔记 2018-05-03
  • 数组复制 expect

    变量                                                                                       /* 内存空间 存储单个元素 */ 数组 /* 连续的内存空间 存储多个元素 */ /* 多个变量的集合 */ 数组名 声明数组 /* declare -a Ary_Name */ …

    Linux笔记 2018-07-08
  • 小白加薪升职记之正则表达式基础

    正则表达式基础命令

    Linux笔记 2018-06-01