zoukankan      html  css  js  c++  java
  • 在LNMP环境中部署一个blog服务程序

    一、MySQL数据库配置准备
      1.MySQL数据库配置准备
        1)登录MySQL数据库
          mysql -uroot -p
        2)创建一个专用的数据库WordPress,用于存放blog数据
          create database wordpress;
          show databases like 'wordpress';#查看数据库
        3)创建一个专用的WordPress blog管理用户
          grant all on wordpress.* to wordpress@'localhost' identified by '123456';#创建一个专用的管理用户
          flush privileges;#刷新权限使新建用户生效
          show grants for wordpress@'localhost';#查看用户对用的权限
          select user,host from mysql.user;#查看数据库中创建的wordpress用户

          创建成功情况如下:
            mysql> show databases like 'wordpress';
            +----------------------+
            | Database (wordpress) |
            +----------------------+
            | wordpress            |
            +----------------------+
            1 row in set (0.00 sec)

            mysql> grant all on wordpress.* to wordpress@'localhost' identified by '123456';
            Query OK, 0 rows affected (0.00 sec)

            mysql> flush privileges;
            Query OK, 0 rows affected (0.01 sec)

            mysql> show grants for wordpress@'localhost';
            +------------------------------------------------------------------------------------------------------------------+
            | Grants for wordpress@localhost                                                                                   |
            +------------------------------------------------------------------------------------------------------------------+
            | GRANT USAGE ON *.* TO 'wordpress'@'localhost' IDENTIFIED BY PASSWORD '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' |
            | GRANT ALL PRIVILEGES ON `wordpress`.* TO 'wordpress'@'localhost'                                                 |
            +------------------------------------------------------------------------------------------------------------------+
            2 rows in set (0.00 sec)

            mysql> select user,host from mysql.user;
            +-----------+-------------------+
            | user      | host              |
            +-----------+-------------------+
            | root      | 127.0.0.1         |
            | root      | ::1               |
            |           | instance-yf0xzby9 |
            | root      | instance-yf0xzby9 |
            |           | localhost         |
            | root      | localhost         |
            | wordpress | localhost         |#只允许本机通过wordpress用户访问数据库
            +-----------+-------------------+

      2.Nginx及PHP环境配置准备
        1)选择前文配置好的支持LNMP的blog域名对应的虚拟主机
            [root@instance-yf0xzby9 ~]# cd /application/nginx/conf/extra/
            [root@instance-yf0xzby9 extra]# vi blog.conf
            [root@instance-yf0xzby9 extra]# cat blog.conf
              server {
                  listen       80;
                  server_name  blog.etiantian.org;
                  location / {
                      root   html/blog;
                      index  index.php index.html index.htm;
                  }
                  error_page   500 502 503 504  /50x.html;
                  location = /50x.html {
                      root   html;
                  }
            location ~ .*.(php|php)?$ {
                root html/blog;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi.conf;
            }
              }
        2)获取WordPress博客程序,并放置到blog域名对应虚拟主机的站点目录下,即html/blog
          cd ../../html/blog
          ls -sh wordpress-4.9.8.tar.gz
          [root@instance-yf0xzby9 blog]# ls -sh wordpress-4.9.8.tar.gz
          8.4M wordpress-4.9.8.tar.gz
          [root@instance-yf0xzby9 blog]# pwd
          /application/nginx/html/blog
          [root@instance-yf0xzby9 blog]# tar xf wordpress-4.9.8.tar.gz
          [root@instance-yf0xzby9 blog]# ls
          index.html  test_info.php  wordpress  wordpress-4.9.8.tar.gz
          rm -f index.html test_mysql.php
          mv wordpress/* . #将内容转移带blog根目录
          /bin/mv wordpress-4.9.8.tar.gz /home/hty/tools/
          ls -l
          chown -R nginx.nginx ../blog/ #授权nginx及php服务访问blog站点目录
          ls -l
    二、安装blog博客程序
          打开浏览器输入blog.etiantain.org(提前做好host或者DNS解析)安装WordPress

  • 相关阅读:
    [HDOJ1261]最少拦截系统
    Gym 100637F F. The Pool for Lucky Ones
    Codeforces Gym 100637A A. Nano alarm-clocks 前缀和处理
    HDU 1166 敌兵布阵 线段树
    【Tyvj1038】忠诚 线段树
    Codeforces Gym 100513G G. FacePalm Accounting
    Codeforces Round #313 (Div. 2)B.B. Gerald is into Art
    Codeforces Round #313 (Div. 2) D. Equivalent Strings
    Codeforces Round #313 (Div. 2) C. Gerald's Hexagon 数学
    Codeforces Round #313 (Div. 2) A. Currency System in Geraldion
  • 原文地址:https://www.cnblogs.com/01black-white/p/9728380.html
Copyright © 2011-2022 走看看