docker wordpress 快速部署
1.拉取mysql
docker pull mysql
2.拉取wordpress
docker pull wordpress
3.启动mysql
docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -v /data/mysql_data:/var/lib/mysql mysql:latest
4.启动wordpress
docker run -d --name wordpress -v /data/wordpress_data:/var/www/html -e WORDPRESS_DB_HOST:mysql -e WORDPRESS_DB_USER:root -e WORDPRESS_DB_PASSWORD:123456 -e WORDPRESS_DB_NAME:wordpress --link mysql:mysql -p 8090:80 wordpress
5.访问wordpress
http://localhost:8090/
6.建立wp-config.php文件
cd /data/wordpress_data vi wp-config.php
复制网站内容写入文件wp-config.php:
<?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the installation. * You don't have to use the web site, you can copy this file to "wp-config.php" * and fill in the values. * * This file contains the following configurations: * * * Database settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://wordpress.org/support/article/editing-wp-config-php/ * * @package WordPress */ // ** Database settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'wordpress' ); /** Database username */ define( 'DB_USER', 'root' ); /** Database password */ define( 'DB_PASSWORD', '123456' ); /** Database hostname */ define( 'DB_HOST', '172.16.17.37:3306' ); /** Database charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8mb4' ); /** 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', '&900PH~yi{)8-y>+:]V@W`5Xs<oN#/se9`*P3*Axr}LZA.3_UzlM[U6IR|MS2G?5' ); define( 'SECURE_AUTH_KEY', 'G_m~4fxJxav7A`}]!X($8h?Un`n#v3;@h`)D;Z=}]QXVOSh`75%d!lwc2O]xC3ku' ); define( 'LOGGED_IN_KEY', '61aV=5Hr(#SE=Y:ZOvjBxGIL!;5>mh*$D>;$l-,u%U=<r[@h^Ch4w?[]>n9n@PIF' ); define( 'NONCE_KEY', 'J;{ay[HV jT+6wA!0Th+,I19wQK;W_R?/%g%tzk.IuhsN=R7rf&EOE23yNprc289' ); define( 'AUTH_SALT', 'a=}G:ZLH7L,%&MY5^*g]|lXHH<)3DrC/lN^=<J#+vEhLBQr5A.|ArtfOQ&WV)FjS' ); define( 'SECURE_AUTH_SALT', 'pg(N#:/fQ^y`=S$ +FT2C*&>3yly?A-J)1)tc:MoLyT3I>EDZS^)](b+k4.2;xf%' ); define( 'LOGGED_IN_SALT', 'IG:v)<k~U:qWVA.R4#yK4zwh0omZw:%by{bzDl%@977C)vLKJA4oO[s,6K+U4*Q4' ); define( 'NONCE_SALT', 'f`:LcE!>E[+*vu&c.CjHY _i+A`5.C?YSvbkVm_-a.z[REvMI6~ZNC~]Ih7MlUg6' ); /**#@-*/ /** * 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 documentation. * * @link https://wordpress.org/support/article/debugging-in-wordpress/ */ define( 'WP_DEBUG', false ); /* Add any custom values between this line and the "stop editing" line. */ /* That's all, stop editing! Happy publishing. */ /** Absolute path to the WordPress directory. */ if ( ! defined( 'ABSPATH' ) ) { define( 'ABSPATH', __DIR__ . '/' ); } /** Sets up WordPress vars and included files. */ require_once ABSPATH . 'wp-settings.php';
7.安装wp