Skip to content

Instantly share code, notes, and snippets.

@fliphess
Last active January 11, 2017 10:44
Show Gist options
  • Save fliphess/7a2f7e8da9979e24754df894c3a7aeeb to your computer and use it in GitHub Desktop.
Save fliphess/7a2f7e8da9979e24754df894c3a7aeeb to your computer and use it in GitHub Desktop.
proxy to wordpress on a cluster domain from a hypernode

Proxy wordpress from a hypernode to a cluster domain

Run on cluster shellserver

  • Install wp cli on cluster shellserver:
# Download wp cli
test -d ~/bin || mkdir ~/bin
wget -O ~/bin/wp-cli https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  • Install wordpress on a cluster domain in a subdir of the public webroot (ie: /blog/):
~/bin/wp-cli core download --force
~/bin/wp-cli core config --dbhost='dbhost' --dbname='dbname' --dbuser='dbuser' --dbpass='dbpass'
~/bin/wp-cli core install --title="blog" --admin_user="your-admin-user" --admin_password="your-admin-password" --admin_email="[email protected]" --url='https://www.magentotestpakket.nl/blog/'
~/bin/wp-cli plugin activate --all
~/bin/wp-cli core update-db
~/bin/wp-cli cache flush
  • Create htaccess in webroot dir of the cluster domain:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Service panel actions

  • Enable "servicealias catchall" in byte SP section "subdomeinen"

  • Create the following config as server.blog:

location ^~ /blog {
    expires off;
    proxy_redirect off;

    proxy_pass https://46.21.239.157;
    proxy_set_header Host www.magentotestpakket.nl;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X_FORWARDED_PROTO "https";
    proxy_set_header HTTP_X_FORWARDED_PROTO "https";
    proxy_set_header X-Real-IP \$remote_addr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment