系统城装机大师 - 固镇县祥瑞电脑科技销售部宣传站!

当前位置:首页 > 系统教程 > Linux教程 > 详细页面

yum安装lnmp教程,yum安装lnmp+wordpress

时间:2020-09-10来源:www.pcxitongcheng.com作者:电脑系统城

yum安装lnmp+wordpress

基础配置

xserver1解压打开虚拟机配置ip

挂载镜像

# mkdir /opt/centos

# mount CentOS-7-x86_64-DVD-1511.iso /opt/centos/

配置本地yum源文件

# mv /etc/yum.repos.d/* /media/

# 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

关闭防火墙

# setenforce 0

# systemctl stop firewalld

安装配置lnmp

安装服务

# yum install -y nginx mariadb mariadb-server php-fpm php-mysql

创建目录

# mkdir /www

# chown nginx:nginx /www/

编辑nginx文件

# vi /etc/nginx/fastcgi_params

 

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;       //添加这行
fastcgi_param  REQUEST_URI        $request_uri;

 

# vi /etc/nginx/conf.d/default.conf

location / {
        root   /www;                 //更改网页目录
        index  index.php index.html index.htm;      //添加index.php
    }
 

location ~ \.php$ {                //去掉这部分前面的注释符
        root           /www;           //更改目录
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        include        fastcgi_params;
    }

启动服务

# systemctl start nginx

查看服务状态

# systemctl status nginx

编辑php文件

# vi /etc/php-fpm.d/www.conf

user = nginx           //修改用户和组

group = nginx

启动服务

# service php-fpm start
Redirecting to /bin/systemctl start  php-fpm.service

查看服务状态

# systemctl status php-fpm

初始化数据库

# systemctl start mariadb

# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
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:                                             ##输入数据库root密码
Re-enter new password:
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!
 
查看服务状态
# systemctl status mariadb

进入数据库

# mysql -uroot -p000000

授权在任何客户端机器上可以以root用户登录到数据库

> grant all privileges on *.* to root@'%' identified by '000000';

创建数据库

> create database wordpress;

退出数据库

查看端口

# yum install -y net-tools

# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      3458/php-fpm: maste
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      3854/mysqld         
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3449/nginx: master  
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1422/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2025/master         
tcp6       0      0 :::22                   :::*                    LISTEN      1422/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      2025/master     

部署wordpress

解压文件

# yum install -y unzip

# unzip wordpress-4.7.3-zh_CN.zip

修改配置文件

# mv wordpress/* /www/

# cp /www/wp-config-sample.php /www/wp-config.php

# vi /www/wp-config.php

// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');

/** MySQL数据库用户名 */
define('DB_USER', 'root');

/** MySQL数据库密码 */
define('DB_PASSWORD', '000000');

/** MySQL主机 */
define('DB_HOST', '192.168.100.10');

/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');

/** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');

 

网页访问ip

设置WordPress的站点标题为自己的姓名

分享到:

相关信息

  • linux 文件权限怎么解析

    常用权限linux系统内有档案有三种身份 u:拥有者 g:群组 o:其他人这些身份对于文档常用的有下面权限:r:读权限,用户可以读取文档的内容,如用cat,more查看w:写权限,用户可以编辑文档x...

    2024-07-07

  • 如何使用WPSeku找出 WordPress 安全问题?

    然而,如果我们遵循通常的 WordPress 最佳实践,这些安全问题可以避免。在本篇中,我们会向你展示如何使用 WPSeku,一个 Linux 中的 WordPress 漏洞扫描器,它可以被用来找出你安装...

    2024-07-03

系统教程栏目

栏目热门教程

人气教程排行

站长推荐

热门系统下载