【1+X云计算笔记】Xserver1+LNMP+WordPress

【1+X云计算笔记】Xserver1+LNMP+WordPress

IP:192.168.200.20

网卡配置

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno33554960

图片[1]-【1+X云计算笔记】Xserver1+LNMP+WordPress-子許导航-学习分享

重启网络

#service network restart

图片[2]-【1+X云计算笔记】Xserver1+LNMP+WordPress-子許导航-学习分享

1.关闭防火墙

[root@localhost ~]# setenforce 0

[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# systemctl disable firewalld

2.配置yum源

[root@localhost ~]# mkdir /opt/centos

[root@localhost ~]# mount CentOS-7-x86_64-DVD-1511.iso /opt/centos

[root@localhost ~]# mv /etc/yum.repos.d/* /media/

[root@localhost ~]# vi /etc/yum.repos.d/local.repo

[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1

[lnmp]
name=lnmp
baseurl=file:///root/lnmp
gpgcheck=0
enabled=1

[root@localhost ~]# yum repolist

3.安装配置nginx

[root@localhost ~]# yum install -y nginx

[root@localhost ~]# vi /etc/nginx/conf.d/default.conf

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm index.php;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param	SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

[root@localhost ~]# systemctl restart nginx

4.安装配置mysql

[root@localhost ~]# yum install -y mariadb mariadb-server

[root@localhost ~]# systemctl restart mariadb

[root@localhost ~]# mysql_secure_installation

……

Enter current password for root (enter for none):

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB

root user without the proper authorisation.

Set root password? [Y/n] y

New password: 000000

Re-enter new password: 000000

Password updated successfully!

Reloading privilege tables..

 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone

to log into MariaDB without having to have a user account created for

them.  This is intended only for testing, and to make the installation

go a bit smoother.  You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n] y

 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n

 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can

access.  This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n] y

 - Dropping test database...

 ... Success!

 - Removing privileges on test database...

 ... Success!

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

Reload privilege tables now? [Y/n] y

 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB

installation should now be secure.

Thanks for using MariaDB!

[root@localhost ~]# mysql -uroot -p000000

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 9

Server version: 5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, 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 privileges on *.* to root@localhost identified by '000000';

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on *.* to root@'%' identified by '000000';

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> Ctrl-C -- exit!

Aborted

5.安装配置php

[root@localhost ~]# yum install -y php-fpm php-mysql

[root@localhost ~]# vi /etc/php-fpm.d/www.conf

……

user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

……

[root@localhost ~]# systemctl restart php-fpm

6.部署WordPress

[root@localhost ~]# yum install -y unzip

[root@localhost ~]# unzip wordpress-4.7.3-zh_CN.zip

[root@localhost ~]# rm -rf /usr/share/nginx/html/*

[root@localhost ~]# cp -rvf wordpress/* /usr/share/nginx/html/

[root@localhost ~]# cd /usr/share/nginx/html/

[root@localhost html]# chmod 777 *

[root@localhost html]# cp wp-config-sample.php wp-config.php

[root@localhost html]# vi wp-config.php

/** WordPress数据库的名称 */

define(‘DB_NAME’, ‘wordpress’);

/** MySQL数据库用户名 */

define(‘DB_USER’, ‘root’);

/** MySQL数据库密码 */

define(‘DB_PASSWORD’, ‘000000’);

系统CTL重新启动

#systemctl restart nginx

#systemctl restart php-fpm

# systemctl restart mariadb

© 版权声明
THE END
喜欢就支持一下吧
点赞9 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容