Ubuntu LNMP怎么部署WordPress

 2479

下面由WordPress教程栏目给大家介绍Ubuntu LNMP怎么部署 WordPress,希望对需要的朋友有所帮助!

Ubuntu LNMP 部署 WordPress


软件版本说明:

Ubuntu: 16.04 LTS;

WordPress: 4.7 zh-CN


安装 PHP7.1

1、首先添加 PPA

sudo apt-get update
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php -y
sudo apt-get update

2、然后,安装 PHP7.1

sudo apt-get -y install php7.1
sudo apt-get -y install php7.1-mysql php7.1-fpm


安装 Mysql

sudo apt-get -y install mysql-server-5.7

设置密码就,OK。

至此,基本的 WordPress 环境就准备完毕了。


部署 WordPress

首先通过 git 拉取 WordPress 源代码:

git clone https://github.com/JellyBool/wordpress.git /var/www/wordpress


配置 Mysql

通过下面的命令来登录 mysql:

mysql -u root -p

在 mysql 执行:

CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
 
CREATE USER 'jellybool' IDENTIFIED BY 'laravist';
GRANT ALL PRIVILEGES ON wordpress.* TO 'jellybool';
 
quit

注意上面的 jellyboollaravist是根据你自己的需求来设置的。


配置 Nginx

打开配置文件:

vim /etc/nginx/sites-available/default

进行以下配置配置:

root /var/www/wordpress;
 
index index.php index.html index.htm index.nginx-debian.html;
# 注意我们添加了 index.php
 
location / {
    try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
    try_files $uri /index.php =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

访问你的域名,就可以进行非常出名的 WordPress 五分钟安装过程啦!安装完毕之后,你就拥有一个 WordPress 的站点啦!


最后

配置 WordPress 文件上传,打开 wp-config.php 文件:

define('FS_METHOD', 'direct');
define('FS_CHMOD_DIR', 0777);
define('FS_CHMOD_FILE', 0777);


安装其他的 php 扩展

sudo apt install -y php7.1-gd php7.1-mbstring php7.1-xmlrpc

至此,打完收工。


本文网址:https://www.zztuku.com/detail-8871.html
站长图库 - Ubuntu LNMP怎么部署WordPress
申明:如有侵犯,请 联系我们 删除。

评论(0)条

您还没有登录,请 登录 后发表评论!

提示:请勿发布广告垃圾评论,否则封号处理!!

    编辑推荐