-
-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathwp-config-staging.txt
291 lines (221 loc) · 17.1 KB
/
wp-config-staging.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<?php
/** ********************************************************************************************* */
/** author: SlickStack ************************************************************************** */
/** link: https://slickstack.io ***************************************************************** */
/** mirror: littlebizzy/slickstack/blob/master/modules/wordpress/wp-config-staging.txt ********** */
/** path: n/a (boilerplate) ********************************************************************* */
/** destination: /var/www/html/staging/wp-config.php (after install) **************************** */
/** purpose: WordPress configuration file boilerplate for SlickStack staging sites ************** */
/** module version: WordPress 6.6.x ************************************************************* */
/** sourced by: wp-settings.php ***************************************************************** */
/** bash aliases: n/a (ss-install-wordpress-config) ********************************************* */
/** ********************************************************************************************* */
/** DO NOT MODIFY WP-CONFIG DIRECTLY AS CHANGES WILL BE OVERWRITTEN BY SLICKSTACK */
/** THIS BOILERPLATE FOR SINGLE SITES ONLY (ANOTHER EXISTS FOR MULTISITES) */
/** ********************************************************************************************* */
/** WP-Config (Staging): Include SlickStack Constants ******************************************* */
/** ********************************************************************************************* */
/** below are some general PHP constants that show the status of SlickStack modules */
/** ss-constants.php should never be modified and is outside the public root */
include_once('/var/www/meta/ss-constants.php');
/** ********************************************************************************************* */
/** WP-Config (Staging): Database Settings ****************************************************** */
/** ********************************************************************************************* */
/** database connection settings should only be modified inside the ss-config file */
/** SlickStack will create the database and user if they do not exist yet */
define( 'DB_NAME', 'staging' ); // ss = staging
define( 'DB_USER', '@DB_USER' ); // ss = *must be unique*
define( 'DB_PASSWORD', '@DB_PASSWORD' ); // ss = *must be unique*
define( 'DB_HOST', '@DB_HOST:@DB_PORT' ); // ss = 127.0.0.1:3306
define( 'DB_CHARSET', '@DB_CHARSET' ); // ss = utf8mb4
define( 'DB_COLLATE', '@DB_COLLATE' ); // ss = (blank)
$table_prefix = '@DB_PREFIX'; // ss = wp_
/** ********************************************************************************************* */
/** WP-Config (Staging): Environment Settings *************************************************** */
/** ********************************************************************************************* */
/** SlickStack supports distinct prod/staging/dev sites so we hardcode environment */
/** each site has its own database and files so WP_LOCAL_DEV not supported */
define('WP_ENVIRONMENT_TYPE', 'staging'); // ss = staging
define('WP_LOCAL_DEV', false); // ss = false
/** ********************************************************************************************* */
/** WP-Config (Staging): Domain Settings ******************************************************** */
/** ********************************************************************************************* */
/** all domain settings are hardcoded to avoid conflicts and maintain best practices */
/** there should never be any reason to change these settings no matter what */
define('WP_HOME', 'https://staging.@SITE_DOMAIN_EXCLUDING_WWW'); // ss = *must be unique*
define('WP_SITEURL', 'https://staging.@SITE_DOMAIN_EXCLUDING_WWW'); // ss = *must be unique*
define('WP_CONTENT_URL', 'https://staging.@SITE_DOMAIN_EXCLUDING_WWW/wp-content'); // ss = *must be unique*
define('WP_PLUGIN_URL', 'https://staging.@SITE_DOMAIN_EXCLUDING_WWW/wp-content/plugins'); // ss = *must be unique*
define('WP_CONTENT_DIR', '/var/www/html/staging/wp-content'); // ss = /var/www/html/staging/wp-content
define('WP_PLUGIN_DIR', '/var/www/html/staging/wp-content/plugins'); // ss = /var/www/html/staging/wp-content/plugins
define('WP_LANG_DIR', '/var/www/html/staging/wp-content/languages'); // ss = /var/www/html/staging/wp-content/languages
define('WP_TEMP_DIR', '/var/www/html/staging/wp-content/temp'); // ss = /var/www/html/staging/wp-content/temp
define('UPLOADS', 'wp-content/uploads'); // ss = wp-content/uploads
/** ********************************************************************************************* */
/** WP-Config (Staging): SSL Settings *********************************************************** */
/** ********************************************************************************************* */
/** as SlickStack is HTTPS-only we hardcode SSL admin and login for WordPress here */
/** our Force HTTPS plugin is also included as a default WordPress MU plugin */
define('FORCE_SSL_ADMIN', true); // ss = true
define('FORCE_SSL_LOGIN', true); // ss = true
/** ********************************************************************************************* */
/** WP-Config (Staging): Cookie Settings ******************************************************** */
/** ********************************************************************************************* */
/** for single sites prod/staging/dev use distinct cookies to avoid login conflicts */
/** but for Multisite networks each site in COOKIE_DOMAIN is auto-detected */
define('COOKIE_DOMAIN', 'staging.@SITE_DOMAIN_EXCLUDING_WWW');
define('COOKIEPATH', '/');
define('SITECOOKIEPATH', '/');
define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin');
/** ********************************************************************************************* */
/** WP-Config (Staging): Debug Settings ********************************************************* */
/** ********************************************************************************************* */
/** most debugging and error handling is hardcoded in SlickStack for better stability */
/** for more verbose debugging use staging/dev sites as WP_DEBUG_LOG enabled */
define('WP_DEBUG', true); // ss = true
define('WP_DEBUG_LOG', true); // ss = true (enables debug.log)
define('WP_DEBUG_DISPLAY', false); // ss = false
/** ********************************************************************************************* */
/** WP-Config (Staging): Core Update Settings *************************************************** */
/** ********************************************************************************************* */
/** for security reasons SlickStack does not prevent WordPress from receiving updates */
/** minor releases (patches) will auto-update and bundled themes are skipped */
define('AUTOMATIC_UPDATER_DISABLED', false); // ss = false
define('WP_AUTO_UPDATE_CORE', 'minor'); // ss = minor
define('CORE_UPGRADE_SKIP_NEW_BUNDLED', true); // ss = true
/** ********************************************************************************************* */
/** WP-Config (Staging): Salt Settings ********************************************************** */
/** ********************************************************************************************* */
/** the salt strings are used by WordPress to secure and randomize login sessions etc */
/** to avoid conflicts we do not mix complex symbols in the generated strings */
define('AUTH_KEY', '@AUTHKEY'); // ss = *must be unique*
define('SECURE_AUTH_KEY', '@SECUREAUTHKEY'); // ss = *must be unique*
define('LOGGED_IN_KEY', '@LOGGEDINKEY'); // ss = *must be unique*
define('NONCE_KEY', '@NONCEKEY'); // ss = *must be unique*
define('AUTH_SALT', '@AUTHSALT'); // ss = *must be unique*
define('SECURE_AUTH_SALT', '@SECUREAUTHSALT'); // ss = *must be unique*
define('LOGGED_IN_SALT', '@LOGGEDINSALT'); // ss = *must be unique*
define('NONCE_SALT', '@NONCESALT'); // ss = *must be unique*
define('WP_CACHE_KEY_SALT', 'staging.@SITE_DOMAIN_EXCLUDING_WWW'); // ss = staging.example.com
/** ********************************************************************************************* */
/** WP-Config (Staging): WP-Cron Settings ******************************************************* */
/** ********************************************************************************************* */
/** setting WP_CRON_METHOD to server in ss-config will disable WP Cron in below field */
/** ALTERNATE_WP_CRON is force disabled and should not be needed on SlickStack */
define('DISABLE_WP_CRON', true); // ss = true
define('ALTERNATE_WP_CRON', false); // ss = false
define('WP_CRON_LOCK_TIMEOUT', 30); // ss = 30 seconds
/** ********************************************************************************************* */
/** WP-Config (Staging): Default Theme ********************************************************** */
/** ********************************************************************************************* */
/** default WordPress theme for new installs or in case your other themes are broken */
/** it can also make it easier when sharing a database between multiple sites */
define( 'WP_DEFAULT_THEME', 'hovercraft' ); // ss = hovercraft
/** ********************************************************************************************* */
/** WP-Config (Staging): Cache Settings ********************************************************* */
/** ********************************************************************************************* */
/** because SlickStack uses server-level Nginx caching we disable WordPress caching */
/** any plugins or themes that require cache directory are improperly coded */
define('WP_CACHE', false); // ss = false
/** ********************************************************************************************* */
/** WP-Config: File + Upload + API Permissions Settings ***************************************** */
/** ********************************************************************************************* */
/** default file permissions */
define('FS_METHOD', 'direct'); // ss = direct
define('FS_CHMOD_DIR', (0775 & ~ umask())); // ss = 0775
define('FS_CHMOD_FILE', (0664 & ~ umask())); // ss = 0664
/** restrict external HTTP (API) requests */
define('WP_HTTP_BLOCK_EXTERNAL', @WP_HTTP_BLOCK_EXTERNAL); // ss = false
define('WP_ACCESSIBLE_HOSTS', '@WP_ACCESSIBLE_HOSTS'); // ss = api.wordpress.org
/** restrict backend file modification */
define('DISALLOW_FILE_EDIT', @WP_DISALLOW_FILE_EDIT); // ss = false
define('DISALLOW_FILE_MODS', @WP_DISALLOW_FILE_MODS); // ss = false
/** restrict file (media) uploads */
define('ALLOW_UNFILTERED_UPLOADS', @WP_ALLOW_UNFILTERED_UPLOADS); // ss = true
define('DISALLOW_UNFILTERED_HTML', false); // ss = false
/** ********************************************************************************************* */
/** WP-Config: Various Performance Settings ***************************************************** */
/** ********************************************************************************************* */
/** optimize WordPress memory */
define('WP_MEMORY_LIMIT', '256M'); // ss = 256M
define('WP_MAX_MEMORY_LIMIT', '512M'); // ss = 512M
/** limit post revisions and drafts */
define('WP_POST_REVISIONS', @WP_POST_REVISIONS); // ss = 3
define('AUTOSAVE_INTERVAL', @WP_AUTOSAVE_INTERVAL); // ss = 60 (1 minute)
/** trash management */
define('MEDIA_TRASH', true); // ss = true
define('EMPTY_TRASH_DAYS', 99999999999999999999); // ss = 99999999999999999999
/** ********************************************************************************************* */
/** WP-Config (Staging): WP Admin Optimization Settings ***************************************** */
/** ********************************************************************************************* */
/** keep in mind that SlickStack (Nginx) performs Gzip compression at the server-level */
/** using PHP to compress code uses more CPU and slows down the parsing speed */
define( 'ENFORCE_GZIP', true ); // ss = true
define( 'COMPRESS_CSS', true ); // ss = true
define( 'COMPRESS_SCRIPTS', true ); // ss = true
define( 'CONCATENATE_SCRIPTS', false ); // ss = false
/** ********************************************************************************************* */
/** WP-Config (Staging): Clear Caches (MU Plugin) Settings ************************************** */
/** ********************************************************************************************* */
define( 'CLEAR_CACHES', true ); // ss = true
define( 'CLEAR_CACHES_NGINX', true ); // ss = true
define( 'CLEAR_CACHES_NGINX_PATH', '/var/www/cache/nginx' ); // ss = /var/www/cache/nginx
define( 'CLEAR_CACHES_OBJECT', true ); // ss = true
define( 'CLEAR_CACHES_OPCACHE', true ); // ss = true
/** ********************************************************************************************* */
/** WP-Config (Staging): Force HTTPS (MU Plugin) Settings *************************************** */
/** ********************************************************************************************* */
define( 'FORCE_HTTPS', true ); // ss = true
define( 'FORCE_HTTPS_EXTERNAL_RESOURCES', true ); // ss = true
define( 'FORCE_HTTPS_INTERNAL_LINKS', true ); // ss = true
define( 'FORCE_HTTPS_INTERNAL_RESOURCES', true ); // ss = true
// define( 'FORCE_HTTPS_EXTERNAL_LINKS', false ); // default = false
/** ********************************************************************************************* */
/** WP-Config (Staging): Miscellaneous Settings ************************************************* */
/** ********************************************************************************************* */
define( 'DISABLE_NAG_NOTICES', true ); // ss = true
define( 'WPCF7_UPLOADS_TMP_DIR', '/var/www/html/wp-content/temp' ); // ss = /var/www/html/wp-content/temp
/** ********************************************************************************************* */
/** WP-Config (Staging): Inactive Defined Constants (Modify With Custom Functions) ************** */
/** ********************************************************************************************* */
/** the following defined constants should not be hardcoded to allow for modification */
/** modify these constants using the custom-functions.php script or otherwise */
// define( 'WP_ALLOW_REPAIR', false ); // ss = false
// define( 'SAVEQUERIES', false ); // ss = false
// define( 'SCRIPT_DEBUG', false ); // ss = false
/** ********************************************************************************************* */
/** WP-Config (Staging): Include Custom Functions (If Exists) *********************************** */
/** ********************************************************************************************* */
/** rather than editing your wp-config.php file simply create a custom functions file */
/** if SlickStack detects this file exists it will load included constants etc */
$custom_functions = '/var/www/html/staging/wp-content/custom-functions.php';
is_file($custom_functions) AND include $custom_functions;
/** ********************************************************************************************* */
/** WP-Config (Staging): Require WP-Settings File (MUST APPEAR LAST) **************************** */
/** ********************************************************************************************* */
/** the wp-settings.php file is critical to WordPress Core functions and must load last */
/** below snippet also relies on ABSPATH being properly defined in this section */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');
/** ********************************************************************************************* */
/** SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ************* */
/** ********************************************************************************************* */
// Ref: https://wordpress.org/support/article/editing-wp-config-php/
// Ref: https://wordpress.org/support/article/debugging-in-wordpress
// Ref: https://github.com/littlebizzy/custom-functions
// Ref: https://gist.github.com/jrfnl/5925642
// Ref: https://github.com/littlebizzy/slickstack/issues/27
// Ref: https://stackoverflow.com/questions/2473079/how-to-display-all-database-queries-made-by-wordpress
// Ref: https://css-tricks.com/finding-and-fixing-slow-wordpress-database-queries/
// Ref: https://my.wpnet.nz/knowledgebase/24/Tips-for-your-wp-configphp-file.html
// Ref: https://wisdmlabs.com/blog/14-least-known-wordpress-constants-an-overview/
// Ref: https://github.com/WordPress/WordPress/blob/master/wp-includes/script-loader.php
// Ref: https://gist.github.com/bhubbard/8428583
// Ref: https://wordpress.org/support/topic/problems-with-domain_current_site-value/
// Ref: https://docs.woocommerce.com/document/subscriptions-handles-staging-sites/
// Ref: https://github.com/woocommerce/woocommerce/wiki/Thumbnail-Image-Regeneration-in-3.3
// Ref: https://make.wordpress.org/core/2020/07/24/new-wp_get_environment_type-function-in-wordpress-5-5/
// Ref: https://www.bjornjohansen.com/load-scripts-php
// Ref: https://www.fastcomet.com/kb/debugging-wordpress-how-to-use-wp-debug
// SS_EOF