Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wordpress Environment for Multi-Site Setup #195

Closed
aadewojo opened this issue Jan 7, 2017 · 7 comments
Closed

Wordpress Environment for Multi-Site Setup #195

aadewojo opened this issue Jan 7, 2017 · 7 comments

Comments

@aadewojo
Copy link

aadewojo commented Jan 7, 2017

Hi There,

I am new to creating and extending docker images. I would like to build a wordpress container with the multi-site feature. The current and usual one is the default wordpress setting.

Can you please direct me on how to go about it.

Thanks.

@tianon
Copy link
Member

tianon commented Jan 9, 2017

If you just need to deploy a WordPress multi-site instance, I'd recommend using this image as-is and then modifying the wp-config.php of your installed instance to include define( 'WP_ALLOW_MULTISITE', true );, as described over in https://codex.wordpress.org/Create_A_Network#Step_2:_Allow_Multisite.

If you instead need a repeatable image you can deploy in many places with Multisite pre-enabled, then you'll need to modify the file /usr/src/wordpress/wp-config-sample.php. Something like this should do the trick:

FROM wordpress

RUN sed -r -e 's/\r$//' /usr/src/wordpress/wp-config-sample.php \
	| awk '/^\/\*.*stop editing.*\*\/$/ { print("define( \"WP_ALLOW_MULTISITE\", true );") } { print }' > temp.php \
	&& chown --reference /usr/src/wordpress/wp-config-sample.php temp.php \
	&& mv temp.php /usr/src/wordpress/wp-config-sample.php

@aadewojo
Copy link
Author

aadewojo commented Jan 9, 2017

Thank you so much for your reply. I was able to use your suggestion in the second paragraph. I couldn't get it done with the first advice as I could not locate the wp-config.php file. I will be glad if Can you please direct me on how to locate it?

@b-a-t
Copy link

b-a-t commented Feb 13, 2017

In general, wp-config.php doesn't present in the image, it gets created by docker-php-entrypoint startup script during first run of the container. that's why you have to operate on wp-config-sample.php.

@aadewojo
Copy link
Author

Thank you all for the reply. I am still having a bit of problem with wordpress multisite. I have been able to enable the multi site features. But whenever I create a new site, it doesn't allow me to access it ( It shows as a broken page). I can only access the main site in the multisite page. Is this because I am using docker? I am only allowed to use the sub directory form of creating multisite

@tianon
Copy link
Member

tianon commented Apr 3, 2017

That likely depends on how you're routing traffic to it -- how are your domain names set up? Do you have something like NGINX in front, or are you simply letting the WordPress container listen directly on port 80? Is traffic for all your domains being routed to the container appropriately?

@aadewojo
Copy link
Author

aadewojo commented Apr 5, 2017

Thank you for your reply. I am not using nginx, the wordpress container listens directly on port 80 and the database container listens on port 8181.
So the docker-compose file looks like this

wordpresscontainer:
 build: ./php/
 links:
  - wordpressdb:mysql
 ports:
 - 80:80
wordpressdb:
 image: mariadb
 environment:
  MYSQL_ROOT_PASSWORD: password
phpmyadmincontainer:
 image: corbinu/docker-phpmyadmin
 links:
 - wordpressdb:mysql
 ports:
 - 8181:80
 environment:
  MYSQL_USERNAME: root
  MYSQL_ROOT_PASSWORD: password

I don't understand your last question about traffice routed to the container. Also, the setup allows me to only use sub-directory for the multi-site setup.

Thanks and look forward to your reply.

@tianon
Copy link
Member

tianon commented Jan 9, 2018

Sorry for the delay. The only thing I can recommend from here is reading through https://codex.wordpress.org/Create_A_Network and making sure you've followed the steps as described.

In the future, these sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow (or even the WordPress forums, to try and catch more WordPress users than these Docker forums might).

@tianon tianon closed this as completed Jan 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants