Last active
November 12, 2018 03:04
-
-
Save duaneleem/fcb2522da1d39073d33a97af79f14ec0 to your computer and use it in GitHub Desktop.
Immutable WordPress Example. Visit the following for further information: https://blog.duaneleem.com/immutable-wordpress-example/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ================================================================================ | |
# Redirects uploads to production. | |
# ================================================================================ | |
<IfModule mod_rewrite.c> | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^wp-content/uploads/(.*)$ https://www.someotherdomain.com/wp-content/uploads/$1 [R=301,NC,L] | |
</IfModule> | |
# ================================================================================ | |
# Docker WordPress | |
# ================================================================================ | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> | |
# END WordPress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## A general MySQL configuration. | |
version: '3.1' | |
services: | |
main: | |
image: mysql:5.6 | |
network_mode: bridge | |
volumes: | |
- db_data:/var/lib/mysql | |
ports: | |
- 3306:3306 | |
expose: | |
- "3306" | |
restart: always | |
container_name: db-mysql-main | |
environment: | |
MYSQL_ROOT_PASSWORD: somesuperdupersecretpwd | |
volumes: | |
db_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## WordPress instance that connects to db-mysql-main MySQL | |
version: '3' | |
services: | |
wtmain: | |
image: wordpress:4.9.8-php5.6-apache | |
network_mode: bridge | |
volumes: | |
- "/var/www/somedomain.com/sandbox/wp-content/themes:/var/www/html/wp-content/themes" | |
- "/var/www/somedomain.com/sandbox/wp-content/plugins:/var/www/html/wp-content/plugins" | |
- "/var/www/somedomain.com/sandbox/wp-content/uploads:/var/www/html/wp-content/uploads" | |
- "/var/www/somedomain.com/sandbox/.htaccess:/var/www/html/.htaccess" | |
ports: | |
- "8101:80" | |
restart: always | |
container_name: wp-test | |
external_links: | |
- db-mysql-main:mysql | |
environment: | |
WORDPRESS_DB_NAME: wordpress | |
WORDPRESS_DB_USER: usernamegoeshere | |
WORDPRESS_DB_PASSWORD: somesuperdupersecretpwd | |
WORDPRESS_TABLE_PREFIX: wp_ | |
WORDPRESS_CONFIG_EXTRA: | | |
/* Fix site URL. */ | |
define("WP_HOME", "http://someotherdomain.com:8080"); | |
define("WP_SITEURL", "http://someotherdomain.com:8080"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment