2019-07-10

                         LNMP机构部署
一.检查nginx和mariadb php安装版本
[root@web01 ~]# rpm -qa nginx
nginx-1.16.0-1.el7.ngx.x86_64
[root@web01 ~]# rpm -qa mariadb
mariadb-5.5.60-1.el7_5.x86_64
[root@web01 ~]# rpm -qa php*
php71w-cli-7.1.30-1.w7.x86_64
php71w-pecl-igbinary-2.0.5-1.w7.x86_64
php71w-mcrypt-7.1.30-1.w7.x86_64
php71w-pecl-mongodb-1.5.3-1.w7.x86_64
php71w-opcache-7.1.30-1.w7.x86_64
php71w-common-7.1.30-1.w7.x86_64
php71w-xml-7.1.30-1.w7.x86_64
php71w-pear-1.10.4-1.w7.noarch
php71w-pdo-7.1.30-1.w7.x86_64
php71w-pecl-memcached-3.0.4-1.w7.x86_64
php71w-pecl-redis-3.1.6-1.w7.x86_64
php71w-devel-7.1.30-1.w7.x86_64
php71w-mbstring-7.1.30-1.w7.x86_64
php71w-embedded-7.1.30-1.w7.x86_64
php71w-process-7.1.30-1.w7.x86_64
php71w-mysqlnd-7.1.30-1.w7.x86_64
php71w-fpm-7.1.30-1.w7.x86_64
php71w-gd-7.1.30-1.w7.x86_64
[root@web01 ~]# 

nginx安装过程

yum install -y nginx

mariadb安装过程

yum install mariadb-server mariadb -y

php安装过程

第一个历程:移除其他版本php软件

yum remove php-mysql php php-fpm php-common

第二个历程:更新yum源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

第三个历程:yum安装

yum install -y php71w php71w-cli php71w-common php71w-devel php71w-embedded  php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache  php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb
二.LNMP架构如何进行配置:

第一个历程:建立nginx+php关系

[root@web01 conf.d]# cat blog.conf
server {
    listen       80;
    server_name  blog.oldboy.com;
    location / {
        root   /html/blog;
        index  index.html index.htm;
    }
    location ~ \.php$ {
        fastcgi_pass  127.0.0.1:9000;
        root   /html/blog;
        fastcgi_index index.php;
        #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        #include fastcgi_params;
    }
}
[root@web01 conf.d]# 

编写测试文件:

[root@web01 conf.d]# vim /html/blog/test_info.php

第二个历程:php+mariadb建立关系

[root@web01 blog]#  
cat test_mysql.php 

三.总和架构网站代码上线配置

博客网站代码:wordpress https://cn.wordpress.org/download/

首页网站代码:dedecms http://www.dedecms.com/products/dedecms/downloads/

论坛网站代码:discuz https://www.discuz.net/thread-3796882-1-1.html

知乎网站代码:wecenter http://www.wecenter.com/downloads/

博客网站如何部署代码,显示博客页面:

第一个历程:下载代码程序 上传服务器进行解压

进入https://cn.wordpress.org/download/网站下载

上传服务器解压

[root@web01 html]# tar xf wordpress-5.2.2.tar.gz 

修改目录权限

[root@web01 html]# chown -R www.www blog

第二个历程:访问blog页面

创建新的数据库:

创建数据库管理用户:

[root@web01 html]# mysql -uroot -p 
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.60-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)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on wordpress.* to 'wordpress'@'localhost' identified by 'oldboy123';
Query OK, 0 rows affected (0.02 sec)

MariaDB [(none)]> select user.host from mysql.user;
+-----------+
| host      |
+-----------+
| 127.0.0.1 |
| ::1       |
| localhost |
| localhost |
| localhost |
| web01     |
| web01     |
+-----------+
7 rows in set (0.00 sec)

MariaDB [(none)]> 

你可能感兴趣的:(2019-07-10)