simettric/wordpress-composer-installation

dev-master 2016-11-20 10:40 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:53:04 UTC


README

使用composer安装和部署WordPress站点的基配置

您的WordPress安装结构将是

/config-dev.php
/config-prod.php.dist
/vendor
/public
/public/_wp        -> the WordPress installation dir (managed by composer)
/public/index.php  -> the WordPress bootstrap file
/public/wp-content -> the WordPress wp-content directory

它使用 WordPress Packagist 来管理您的插件、主题和其他PHP依赖项

如何开始

步骤1:安装

要求

  • PHP5.4或更高版本

创建您的项目

composer create-project simettric/wordpress-composer-installation your_directory_name "dev-master"

创建您的配置文件

cp config-prod.php.dist config-dev.php
 
# Create the config-prod file if you want to work in production mode directly (not recommender)
# NOTE: If you do this, WordPress will use the config-prod.php file instead the config-dev.php
# cp config-prod.php.dist config-prod.php

设置WordPress权限

# Configure the wp-content/uploads permissions
# https://codex.wordpress.org/Changing_File_Permissions
chmod -R 755 public/wp-content/uploads

步骤2:配置

您需要几乎以下任一配置文件之一

config-dev.php

此文件必须用于开发环境。WordPress只有在没有config-prod.php文件的情况下才会使用它。

config-prod.php

此文件仅用于生产环境。您可能希望在部署过程中自动创建此文件。

在config-prod和config-dev文件中配置您的WordPress URL

//config-dev.php
define('_BASE_URL', 'https://:8887');

配置其余传统wp-config参数

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');

/** MySQL database username */
define('DB_USER', 'username_here');

/** MySQL database password */
define('DB_PASSWORD', 'password_here');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @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 Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix  = 'wp_';

/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the Codex.
*
* @link https://codex.wordpress.org/Debugging_in_WordPress
*/
define('WP_DEBUG', false);