- 安装php
- 安装mysql
- 解压wordpress,放入到nginx的html下面,取名wordpress
- 配置nginx.conf
server {
listen 80;
listen [::]:80;
server_name xxx.xxx.com;
# 网站的根目录
root /usr/share/nginx/html/wordpress;
location / {
# 域名下的模仿访问文件
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$args;
}
# 所有以.php结尾的文件都交给php处理
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny running scripts inside writable directories
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
# caching of files
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}
}
- 将wordpress下的wp-config-sample.php,复制为wp-config.php,配置如下
<?php
/**
* WordPress基础配置文件。
*
* 这个文件被安装程序用于自动生成wp-config.php配置文件,
* 您可以不使用网站,您需要手动复制这个文件,
* 并重命名为“wp-config.php”,然后填入相关信息。
*
* 本文件包含以下配置选项:
*
* * MySQL设置
* * 密钥
* * 数据库表名前缀
* * ABSPATH
*
* @link https://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php
*
* @package WordPress
*/
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define( 'DB_NAME', '数据库名字' );
/** MySQL数据库用户名 */
define( 'DB_USER', '账号' );
/** MySQL数据库密码 */
define( 'DB_PASSWORD', '密码' );
/** MySQL主机 */
define( 'DB_HOST', '127.0.0.1' );
/** 创建数据表时默认的文字编码 */
define( 'DB_CHARSET', 'utf8' );
/** 数据库整理类型。如不确定请勿更改 */
define( 'DB_COLLATE', '' );
/**#@+
* 身份认证密钥与盐。
*
* 修改为任意独一无二的字串!
* 或者直接访问{@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org密钥生成服务}
* 任何修改都会导致所有cookies失效,所有用户将必须重新登录。
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );
/**#@-*/
/**
* WordPress数据表前缀。
*
* 如果您有在同一数据库内安装多个WordPress的需求,请为每个WordPress设置
* 不同的数据表前缀。前缀名只能为数字、字母加下划线。
*/
$table_prefix = 'wp_';
/**
* 开发者专用:WordPress调试模式。
*
* 将这个值改为true,WordPress将显示所有用于开发的提示。
* 强烈建议插件开发者在开发环境中启用WP_DEBUG。
*
* 要获取其他能用于调试的信息,请访问Codex。
*
* @link https://codex.wordpress.org/Debugging_in_WordPress
*/
define('WP_DEBUG', false);
/** ssh 插件 **/
define('FS_METHOD', 'ssh2');
/** cookie **/
define('COOKIE_DOMAIN', '.xxx.xx.com');
/* 好了!请不要再继续编辑。请保存本文件。使用愉快! */
/** WordPress目录的绝对路径。 */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}
/** 设置WordPress变量和包含文件。 */
require_once( ABSPATH . 'wp-settings.php' );
- 关于ssh2,https://cn.wordpress.org/plugins/ssh-sftp-updater-support/
注意:
wp_options表中的siteurl和home对应的url,应与nginx配置中的监听域名保持一致,与域名解析保持一致,否则可能造成域名访问不了,或者解析失败,多套部署时,一定记得修改这个地方
一台服务器布置多个wordpress:
复制数据库,修改名字,修改里面所有的之前的域名信息(可以转为sql文件),更换为新的域名信息;复制nginx下的wordpress文件夹,修改里面的wp-config.php的关于cookie和数据库的配置;复制nginx中关于域名监听的文件,修改为新的域名和root地址;
参考:
https://www.iamue.com/19449
http://www.wordpress.la/3191.html
https://www.wpdaxue.com/briefly-unavailable-for-scheduled-maintenance.html
https://cn.wordpress.org/
https://blog.csdn.net/windows_2015/article/details/53128176
https://www.fuwuqizuyong.cc/tag/wordpress主题
https://www.xiaored.net/