1. 下载最新 workpress 到应用的目录/opt/
cd /opt
sudo wget https://cn.wordpress.org/latest-zh_CN.tar.gz
2. 解压
sudo tar -zxf latest-zh_CN.tar.gz
3. 变更 wordpress 目录的所有者为www-data
sudo chown -R www-data:root wordpress/
4. 安装 php7.x
和php7.x-fpm
ubuntu/debian
sudo apt install php7.x
sudo apt install php7.x-fpm
5. 安装 mysql 数据库创建用户,创建 database
6. 配置 ngxin
- 在
/etc/nginx/sites-enabled/
创建网站的配置文件sudo vim www.xobj.net
- 配置站点
server { listen 80; server_name www.xojb.net; root /opt/wordpress; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location / {try_files $uri $uri/ /index.php?$args;} location ~ \.php$ { #映射到 php7.xfpm(注意版本号)include fastcgi.conf; fastcgi_intercept_errors on; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { #静态文件设置过期时间到最大 expires max; log_not_found off; } }