tar -zxvf wordpress-4.5.3-zh_CN.tar.gz -C /var/www/html
cd /var/www/html/wordpress
cp wp-config-sample.php wp-config.php
vim wp-config.php
四、填写刚才创建的数据库、用户、密码
rm /etc/nginx/nginx.conf
vim /etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 65;
#php max upload limit cannot be larger than this
client_max_body_size 13m;
index index.php index.html index.htm;
# Upstream to abstract backend connection(s) for PHP.
upstream php {
#this should match value of "listen" directive in php-fpm pool
#server unix:/tmp/php-fpm.sock;
server 127.0.0.1:9000;
}
#
#
include conf.d/*.conf;
}
mkdir /etc/nginx/global
vim /etc/nginx/global/restrictions.conf
# Global restrictions configuration file.
# Designed to be included in any server {} block.</p>
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~ /\. {
deny all;
}
# Deny access to any files with a .php extension in the uploads directory
# Works in sub-directory installs and also in multisite network
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
vim /etc/nginx/global/wordpress.conf //commond
# WordPress single blog rules.
# Designed to be included in any server {} block.
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
# Uncomment one of the lines below for the appropriate caching plugin (if used).
#include global/wordpress-wp-super-cache.conf;
#include global/wordpress-w3-total-cache.conf;
# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
# This is a robust solution for path info security issue and works with "cgi.fix_pathinfo = 1" in /etc/php.ini (default)
include fastcgi.conf;
fastcgi_index index.php;
# fastcgi_intercept_errors on;
fastcgi_pass php;
}
vim /etc/nginx/conf.d/mywordpress.conf
server {
server_name mywordpress;
root /var/www/html/wordpress;
index index.php;
include global/restrictions.conf;
include global/wordpress.conf;
}
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 65;
#php max upload limit cannot be larger than this
client_max_body_size 13m;
index index.php index.html index.htm;
# Upstream to abstract backend connection(s) for PHP.
upstream php {
#this should match value of "listen" directive in php-fpm pool
#server unix:/tmp/php-fpm.sock;
server 127.0.0.1:9000;
}
#
#
include conf.d/*.conf;
}
前注:持续更新中。
SHOW.TIME. 写作背景
前段时间,腾讯云+校园由全国各大高校主动申请过的团队承办,分享课题要求基于腾讯云,“在云上搭建个人站点”和“在云上搭建微信小程序”主题二选一。于是目光转到西邮,由我来当“在云上搭建个人站点”主讲,并于近期写文整理和分享推送。
因此,通过本篇可以
FIRST.BLOOD 认知环节
认知环节
云计算 腾讯云 云 + 校园 云+校园 云端 WP
创建一台主机并登录
云服务器
登陆云主机
购买一个数据库实例并初始化
安装并配置必要的软件
DOUBLE.KILL 腾讯云 UI 界面
TRIPLE.KILL 实操环节
一、安装PHP
二、安装 mysql/mariadb
2.1 创建数据库
2.2 创建数据库用户
2.3 设置数据库用户密码
2.4 给数据库用户相应的数据库权限
2.5 更新数据库权限表
三、nginx
四、WordPress
四、填写刚才创建的数据库、用户、密码
测试 nginx 配置文件
重新平滑加载 nginx 配置文件
nginx 配置
https://segmentfault.com/a/1190000002556269
/etc/php-fpm.d/www.conf