### [Ubuntu LNMP怎么部署WordPress](https://www.prosaas.cn/article/8279) **Published:** 2021-05-14T07:12:17 **Author:** 5201314 **Excerpt:** 下面由WordPress教程栏目给大家介绍Ubuntu LNMP怎么部署 WordPress,希望对需要的朋友… 下面由**WordPress**教程栏目给大家介绍Ubuntu LNMP怎么部署 WordPress,希望对需要的朋友有所帮助! **Ubuntu LNMP 部署 WordPress** 软件版本说明: - Ubuntu: `16.04 LTS`; - WordPress: `4.7 zh-CN` > 适用人群:初级 `PHP 入门者`和广大想拥有自己站点的`设计师`! # 安装 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 > 注意上面的 `jellybool`和`laravist`是根据你自己的需求来设置的。 # 配置 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 至此,打完收工。 以上就是Ubuntu LNMP怎么部署WordPress的详细内容,更多请关注知企PROSAAS其它相关文章! **Tags:** git, mysql, nginx, php, ubuntu, WordPress **Categories:** WordPress ---