Add proxy in front
This commit is contained in:
11
templates/proxy.conf.j2
Normal file
11
templates/proxy.conf.j2
Normal file
@ -0,0 +1,11 @@
|
||||
server {
|
||||
server_name {{website.external_hostname}};
|
||||
location / {
|
||||
proxy_pass http://{{jails.webserver.ip}}:{{website.port}};
|
||||
proxy_set_header Host $host:$server_port;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
@ -79,6 +79,22 @@ $table_prefix = 'wp_';
|
||||
*/
|
||||
define( 'WP_DEBUG', false );
|
||||
|
||||
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
|
||||
$_SERVER['HTTPS']='on';
|
||||
$_SERVER['SERVER_PORT']=443;
|
||||
}
|
||||
|
||||
if ( isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
||||
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
|
||||
define('WP_SITEURL', 'https://{{website.external_hostname}}');
|
||||
define('WP_HOME', 'https://{{website.external_hostname}}');
|
||||
}else{
|
||||
define('WP_SITEURL', "http://{$_SERVER['HTTP_HOST']}");
|
||||
define('WP_HOME', "http://{$_SERVER['HTTP_HOST']}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* That's all, stop editing! Happy publishing. */
|
||||
|
||||
/** Absolute path to the WordPress directory. */
|
||||
|
||||
Reference in New Issue
Block a user