Prechádzať zdrojové kódy

Set variables before the 'stop editing' section

Some random notes:
X-Real-IP, X-Client-IP : client (browser) IP in non-proxy case
X-Forwarded-For : client IP in proxy case
X-Forwarded-Host : Server name in proxy case
X-Forwarded-Proto : https/http in proxy case

PHP:
SERVER_PORT - apache sets this of the port it got the request on
HTTP_HOST - apache sets this to srver name. in cloudron, we actually set this in nginx
    when doing proxy pass. One can also use the X-Forwarded-Host above.

Wordpress:
HTTPS - set this to generate https urls. Otherwise, it is based on SERVER_PORT
HOME_URL, SITE_URL - variables used to configure wordpress location. when unspecified,
    this is computed from HTTPS variable and HTTP_HOST

Wordpress saves lots of options above in DB (!) including HOME_URL and SITE_URL. These
are saved at installation time and can be updated from admin pages.
Girish Ramakrishnan 10 rokov pred
rodič
commit
61fe9c064c
2 zmenil súbory, kde vykonal 11 pridanie a 15 odobranie
  1. 1 3
      start.sh
  2. 10 12
      wp-config.php.template

+ 1 - 3
start.sh

@@ -25,9 +25,7 @@ sed -e "s/define('DB_NAME',.*/define('DB_NAME', '${db}');/" \
     -e "s/define('DB_USER',.*/define('DB_USER', '${username}');/" \
     -e "s/define('DB_PASSWORD',.*/define('DB_PASSWORD', '${password}');/" \
     -e "s/define('DB_HOST',.*/define('DB_HOST', '${host}');/" \
-    -e "s|define('WP_HOME',.*|define('WP_HOME', 'https://$(hostname -f)');|" \
-    -e "s|define('WP_SITEURL',.*|define('WP_SITEURL', 'https://$(hostname -f)');|" \
     /app/configs/wp-config.php.template > /app/code/wp-config.php
 
-/usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i MediaWiki
+/usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i WordPress
 

+ 10 - 12
wp-config.php.template

@@ -80,18 +80,6 @@ define('WPLANG', '');
  */
 define('WP_DEBUG', false);
 
-/* That's all, stop editing! Happy blogging. */
-
-/** Absolute path to the WordPress directory. */
-if ( !defined('ABSPATH') )
-	define('ABSPATH', dirname(__FILE__) . '/');
-
-/** Sets up WordPress vars and included files. */
-require_once(ABSPATH . 'wp-settings.php');
-
-define('WP_HOME', '');
-define('WP_SITEURL', '');
-
 /*
  http://cmanios.wordpress.com/2014/04/12/nginx-https-reverse-proxy-to-wordpress-with-apache-http-and-different-port/
  http://wordpress.org/support/topic/compatibility-with-wordpress-behind-a-reverse-proxy
@@ -104,3 +92,13 @@ if (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) {
     if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
         $_SERVER['HTTPS']='on';
 }
+
+/* That's all, stop editing! Happy blogging. */
+
+/** Absolute path to the WordPress directory. */
+if ( !defined('ABSPATH') )
+	define('ABSPATH', dirname(__FILE__) . '/');
+
+/** Sets up WordPress vars and included files. */
+require_once(ABSPATH . 'wp-settings.php');
+