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.www58058.com/101646

(2)
N28_剛好遇到小熊貓N28_剛好遇到小熊貓
上一篇 2018-06-24 23:32
下一篇 2018-06-25

相關推薦

欧美性久久久久