Skip to content

Commit ae176e6

Browse files
author
Grant Kinney
committed
Improved deployment compatibility
1 parent 6fd8427 commit ae176e6

9 files changed

+454
-276
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
For each site, WordPress core files are separated from wp-content into their own subfolder. That subfolder is actually a symbolic link to a single copy of the WordPress core files.
66

7-
The wp-config.php file is configured to use different database settings for each site, by looking for a unique db-config.php file within the folder for each different site.
7+
A pointer wp-config file sits next to this single copy of core files and dynamically points to the correct wp-config file within the directory for each site.
88

99
## Requirements ##
1010

@@ -24,12 +24,16 @@ First, clone the repository into a folder on your local development server. Be s
2424
The project has the following structure
2525

2626
Project root ..
27-
- wp-config.php file (used for all sites)
27+
- wp-config.php file (used for local development only; points to each site folder dynamically, depending on which site is being loaded)
2828
- wordpress (git submodule of the official WordPress git repository )
2929
- sample.local (sample site folder)
30+
- index.php (which looks in the /wordpress folder to run wordpress)
3031
- wp-content folder (for themes and plugins)
31-
- db-config.php (database name, user, password, and prefix unique to each site)
32-
- index.php (which looks in the /wordpress folder)
32+
- wp-config.php (site configuration, except for database credientials, which go in files below)
33+
- local-config.php (database credentials for local environment)
34+
- dev-config.php (database credentials for local environment)
35+
- staging-config.php (database credentials for local environment)
36+
- production-config.php (database credentials for local environment)
3337

3438
**Important:** create a symlink to the WordPress core files for each site (this is where the magic happens)
3539

@@ -38,7 +42,11 @@ The project has the following structure
3842

3943
## Database Configuration ##
4044

41-
Each site should have its own database. The specifics are listed in the db-config.php file within each unique site folder.
45+
Each site should have its own separate database. The specifics are listed in the various *-config.php files. Put these files in the .gitignore file for your project so that credentials are not stored in version control.
46+
47+
Remove the files not needed on each development environment. For example, your production server should only have production-config.php (local-config.php, staging-config.php, and dev-config.php should be deleted from the production server).
48+
49+
For *-config.php files on your dev, staging, and production servers, you can place these one directory above the root directory of your site. (This won't work for the local-config.php file, however.)
4250

4351
## Apache Configuration ##
4452

@@ -69,7 +77,7 @@ Modify your system host file to redirect to localhost when that server name is e
6977

7078
* Make a copy of your first site
7179
* Set up a new database for the site
72-
* Modify the db-config.php file to connect your new database
80+
* Modify the *-config.php files to connect the sites database in each server environment
7381
* Set up another virtual host
7482

7583
## Tips ##
@@ -88,10 +96,11 @@ Modify your system host file to redirect to localhost when that server name is e
8896
Check that each site folder has the following:
8997

9098
* index.php (which reads `require('./wordpress/wp-blog-header.php');`)
91-
* db-config.php with correct database information
99+
* local-config.php with correct database information
92100
* wp-content folder
101+
* wp-config.php (in addition to the first wp-config.php in the parent directory)
93102
* symbolic link to wordpress directory
94103

95104
**Make sure that the ServerName of your virtual host and the directory for your site have the same name.**
96105

97-
Thanks to [David Winter](http://davidwinter.me/articles/2012/04/09/install-and-manage-wordpress-with-git/) and [Duane Storey](http://www.duanestorey.com/uncategorized/one-wordpress-install-multiple-sites/) for leading the way
106+
Thanks to [David Winter](http://davidwinter.me/articles/2012/04/09/install-and-manage-wordpress-with-git/), [Duane Storey](http://www.duanestorey.com/uncategorized/one-wordpress-install-multiple-sites/), and [ashfame](https://gist.github.com/ashfame/1923821) for leading the way

sample.local/db-config.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

sample.local/dev-config.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
// ** Development Server - MySQL settings ** //
4+
/** The name of the database for WordPress */
5+
define('DB_NAME', 'database_name_here');
6+
7+
/** MySQL database username */
8+
define('DB_USER', 'username_here');
9+
10+
/** MySQL database password */
11+
define('DB_PASSWORD', 'password_here');
12+
13+
/** MySQL hostname */
14+
define('DB_HOST', 'localhost');
15+
16+
/** Database Charset to use in creating database tables. */
17+
define('DB_CHARSET', 'utf8');
18+
19+
/** The Database Collate type. Don't change this if in doubt. */
20+
define('DB_COLLATE', '');
21+
22+
/**#@+
23+
* Authentication Unique Keys and Salts.
24+
*
25+
* Change these to different unique phrases!
26+
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
27+
* 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.
28+
*
29+
* @since 2.6.0
30+
*/
31+
define('AUTH_KEY', 'put your unique phrase here');
32+
define('SECURE_AUTH_KEY', 'put your unique phrase here');
33+
define('LOGGED_IN_KEY', 'put your unique phrase here');
34+
define('AUTH_SALT', 'put your unique phrase here');
35+
define('NONCE_KEY', 'put your unique phrase here');
36+
define('SECURE_AUTH_SALT', 'put your unique phrase here');
37+
define('LOGGED_IN_SALT', 'put your unique phrase here');
38+
define('NONCE_SALT', 'put your unique phrase here');

sample.local/local-config.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
// ** Local Development Environment - MySQL settings ** //
4+
/** The name of the database for WordPress */
5+
define('DB_NAME', 'database_name_here');
6+
7+
/** MySQL database username */
8+
define('DB_USER', 'username_here');
9+
10+
/** MySQL database password */
11+
define('DB_PASSWORD', 'password_here');
12+
13+
/** MySQL hostname */
14+
define('DB_HOST', 'localhost');
15+
16+
/** Database Charset to use in creating database tables. */
17+
define('DB_CHARSET', 'utf8');
18+
19+
/** The Database Collate type. Don't change this if in doubt. */
20+
define('DB_COLLATE', '');
21+
22+
/**#@+
23+
* Authentication Unique Keys and Salts.
24+
*
25+
* Change these to different unique phrases!
26+
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
27+
* 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.
28+
*
29+
* @since 2.6.0
30+
*/
31+
define('AUTH_KEY', 'put your unique phrase here');
32+
define('SECURE_AUTH_KEY', 'put your unique phrase here');
33+
define('LOGGED_IN_KEY', 'put your unique phrase here');
34+
define('AUTH_SALT', 'put your unique phrase here');
35+
define('NONCE_KEY', 'put your unique phrase here');
36+
define('SECURE_AUTH_SALT', 'put your unique phrase here');
37+
define('LOGGED_IN_SALT', 'put your unique phrase here');
38+
define('NONCE_SALT', 'put your unique phrase here');

sample.local/production-config.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
// ** Production Server - MySQL settings ** //
4+
/** The name of the database for WordPress */
5+
define('DB_NAME', 'database_name_here');
6+
7+
/** MySQL database username */
8+
define('DB_USER', 'username_here');
9+
10+
/** MySQL database password */
11+
define('DB_PASSWORD', 'password_here');
12+
13+
/** MySQL hostname */
14+
define('DB_HOST', 'localhost');
15+
16+
/** Database Charset to use in creating database tables. */
17+
define('DB_CHARSET', 'utf8');
18+
19+
/** The Database Collate type. Don't change this if in doubt. */
20+
define('DB_COLLATE', '');
21+
22+
/**#@+
23+
* Authentication Unique Keys and Salts.
24+
*
25+
* Change these to different unique phrases!
26+
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
27+
* 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.
28+
*
29+
* @since 2.6.0
30+
*/
31+
define('AUTH_KEY', 'put your unique phrase here');
32+
define('SECURE_AUTH_KEY', 'put your unique phrase here');
33+
define('LOGGED_IN_KEY', 'put your unique phrase here');
34+
define('AUTH_SALT', 'put your unique phrase here');
35+
define('NONCE_KEY', 'put your unique phrase here');
36+
define('SECURE_AUTH_SALT', 'put your unique phrase here');
37+
define('LOGGED_IN_SALT', 'put your unique phrase here');
38+
define('NONCE_SALT', 'put your unique phrase here');

sample.local/staging-config.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
// ** Staging Server - MySQL settings ** //
4+
/** The name of the database for WordPress */
5+
define('DB_NAME', 'database_name_here');
6+
7+
/** MySQL database username */
8+
define('DB_USER', 'username_here');
9+
10+
/** MySQL database password */
11+
define('DB_PASSWORD', 'password_here');
12+
13+
/** MySQL hostname */
14+
define('DB_HOST', 'localhost');
15+
16+
/** Database Charset to use in creating database tables. */
17+
define('DB_CHARSET', 'utf8');
18+
19+
/** The Database Collate type. Don't change this if in doubt. */
20+
define('DB_COLLATE', '');
21+
22+
/**#@+
23+
* Authentication Unique Keys and Salts.
24+
*
25+
* Change these to different unique phrases!
26+
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
27+
* 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.
28+
*
29+
* @since 2.6.0
30+
*/
31+
define('AUTH_KEY', 'put your unique phrase here');
32+
define('SECURE_AUTH_KEY', 'put your unique phrase here');
33+
define('LOGGED_IN_KEY', 'put your unique phrase here');
34+
define('AUTH_SALT', 'put your unique phrase here');
35+
define('NONCE_KEY', 'put your unique phrase here');
36+
define('SECURE_AUTH_SALT', 'put your unique phrase here');
37+
define('LOGGED_IN_SALT', 'put your unique phrase here');
38+
define('NONCE_SALT', 'put your unique phrase here');

0 commit comments

Comments
 (0)