-
clone this git repo
git clone [email protected]:emranio/docker-wordpress-multisite.git. Run the following command to run the wordpress environment on docker'docker compose up -d'
-
to run all containers of the
docker-compose.ymlfile perfectly, make available your computer80ports. -
If you want to change the password of your database change it on environment section of
wpservices ofdocker-compose-ymlfileenvironment: - WORDPRESS_DB_HOST=db - WORDPRESS_DB_NAME=test - WORDPRESS_DB_USER=root - WORDPRESS_DB_PASSWORD=test - WORDPRESS_LOCAL_DEV=true - WORDPRESS_DEBUG=true -
also on db environment section
environment: - MYSQL_DATABASE=test - MYSQL_ROOT_PASSWORD=test - MYSQL_USER=root -
If you face
Error establishing a database connection, delete yourwp-config.phpfile and reload and install it again.
-
Go to
setting->permalinksand set the permalink structure asPost nameand save it. -
Open
wp-config.phpfile and paste the constantsdefine( 'WP_ALLOW_MULTISITE', true );after theWP-DEBUGsection and save it. -
Now reload your wp-admin.
-
Go to
Tools->Network Setupchoose sub directory options and fill the fields and click oninstallbutton. -
Copy the following code and paste it on
wp-config.phpfile afterWP_ALLOW_MULTISITEconstant.define( 'MULTISITE', true ); define( 'SUBDOMAIN_INSTALL', false ); define( 'DOMAIN_CURRENT_SITE', 'localhost' ); define( 'PATH_CURRENT_SITE', '/' ); define( 'SITE_ID_CURRENT_SITE', 1 ); define( 'BLOG_ID_CURRENT_SITE', 1 ); -
Copy the following code and select all and paste it on
.htaccessfile which is on your wordpress root directory.
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
- Now reload your admin panel you will see multi site menu on your left top bar beside the wordpress home menu button.
- to development purpose keep all your plugins within the
wp-content/pluginsdirectory or wordpress plugin directory. - Now reload and make your site as much as you wish.