Config Digital Ocean Droplet as Microservice

apache SSL TLS tmux
Created on 2016-09-29 Last Modified 2018-07-23


Objective

This page is a notes for setting apache server for my digital ocean droplet

Setting

Apache2

  • in file /etc/hosts

    • change 127.0.0.1 localhost to 127.0.1.1 localhost WordPress-CaLP-LPSS
  • change Port

    • in file /etc/apache2/port.conf
    • add ServerName localhost
    • change the line listen *:80 to listen 127.0.0.1:4000
    • disable other modules <IfModule ssl_module> and <IfModule mod_gnutls.c>
    • in file /etc/apache2/site-enabled/000-default.conf
    • change the line <VirtualHost *:80> to <VirtualHost localhost:4000>
  • restart apache2

    • run sudo /etc/init.d/apache2 restart

Wordpress

config WordPress to use proxy

  • add the following lines in /var/www/html/wp-config.php
define(‘WP_PROXY_HOST’, ‘careers.liping.edu.hk’);
define(‘WP_PROXY_PORT’, ’80’);`
define('WP_PROXY_BYPASS_HOSTS', 'localhost, careers.liping.edu.hk');
define('FORCE_SSL_ADMIN', true);
  • add the following lines in `/var/www/html/wp-content/themes/yourTheme/function.php
update_option( 'siteurl', 'http://careers.liping.edu.hk' );
update_option( 'home', 'http://careers.liping.edu.hk' );

Caddy Server

careers.liping.edu.hk

proxy / localhost:4000 {
  header_upstream Host {host}
}

using caddy to run the server through tmux

TODO

Reference

Key Word

  • reverse proxy
  • Microservice
  • load balancing

comments powered by Disqus