-
Notifications
You must be signed in to change notification settings - Fork 1
wordpress
omgslinux edited this page Mar 14, 2025
·
2 revisions
As all the php vhost definitions, the wordpress template takes care of the basic php definitions.
Then, let's take a look at the custom variables:
## WORDPRESS SPECIFIC SETTINGS
# Set ONLY ONE OF THE FOLLOWING. Defaults to single site, which takes precedence when processing
WORDPRESS_SINGLESITE="1"
WORDPRESS_MULTISITE_SUBDIR=""
WORDPRESS_MULTISITE_SUBDOMAIN=""
# For single sites, set the subdir. Default is ""
WORDPRESS_SUBDIR=""
- The WORDPRESS_SINGLESITE should have any value when not being a wordpress multisite. If set, the multisite variables will be ignored.
- The WORDPRESS_MULTISITE_SUBDIR should contain the directory where wordpress is located in the case of a multisite using directories instead of subdomains. If set, the WORDPRESS_MULTISTE_DOMAIN will be ignored.
- The WORDPRESS_MULTISITE_SUBDOMAIN variable should be set in case of a wordpress multisite using domains. In this case, you have to set the SUFFIX variable to the subdomain (not wildcard). So, if you set SUFFIX="example.com", the generated server name will be "example.com *.example.com".
There's also a conf file specific for wordpress, but it should work with no change.
Beyond nginx settings, there's a suggestion for managing wordpress sites behind a reverse proxy where the backend is using http. You may need to add some php code in you wp-config.php
file. There's a commented section in the generated vhosts file:
if (isset ($_SERVER['HTTP_X_FORWARDED_PROTO'])){
//error_log ($_SERVER['HTTP_X_FORWARDED_PROTO'] . "\n", 3, "./http_log");
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
$_SERVER['HTTPS']='on';
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
define('WP_SITEURL', 'https://${SERVER}.${SUFFIX}');
define('WP_HOME', 'https://${SERVER}.${SUFFIX}');
}
}
Where ${SERVER}.${SUFFIX}
both together are the FQDN of the website.