1. 连接mysql,新建wordpress数据库
mysql -u root -p
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
2.新建并进入准备放html的目录
cd /usr/share/nginx
mkdir wp
cd wp
3.授权
chown -R www-data:www-data ./
4.下载、解压
#下载
sudo wget http://wordpress.org/latest.tar.gz
#解压,并把文件移动到当前根目录下
tar -xvf latest.tar.gz
mv wordpress/* ./
5.配置nginx
server{
listen 80;
server_name wp.domain.com;#换成你的域名
root /usr/share/nginx/wp;#换成你的路径
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
}
6.重启nginx
service nginx restart
7.访问域名,做一些简单配置
输入相应的数据库信息,网站信息,用户名密码信息,就完成配置了。
参考
https://www.linode.com/docs/websites/cms/install-wordpress-on-ubuntu-16-04/
网友评论