1. Xen, xcpng
  2. pfsense
  3. LXC
  4. forward proxy and reverse proxy
  5. remote ssh , ssh tunneling
  6. PowerDNS
  7. Cluster Building
  8. pwa -- Progressive Web Application
  9. dig -- domain internet group
  10. NodeRed

Host Subdomain and web-services

  1. Buy a domain name, maybe leo.ai.
  2. Go to PowerDNS, add subdomain abc, it will form abc.leo.ai. Associate the subdomain with ip address from aws.
  3. Go to aws nginx-proxy ip2, add file abc.leo.ai to /etc/nginx/sites-enabled/. Just replace ip2 with localhost
  4. Go to site-proxy ip3, add the same to the same folder, replace ip3 to ip4.
  5. 
    # You should look at the following URL's in order to grasp a solid understanding
    # of Nginx configuration files in order to fully unleash the power of Nginx.
    # https://www.nginx.com/resources/wiki/start/
    # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
    # https://wiki.debian.org/Nginx/DirectoryStructure
    #
    # In most cases, administrators will remove this file from sites-enabled/ and
    # leave it as reference inside of sites-available where it will continue to be
    # updated by the nginx packaging team.
    #
    # This file will automatically load configuration files provided by other
    # applications, such as Drupal or Wordpress. These applications will be made
    # available underneath a path with that package name, such as /drupal8.
    #
    # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
    ##
    
    # Default server configuration
    #
    server {
            listen 80 default_server;
            listen [::]:80 default_server;
    
            # SSL configuration
            #
            # listen 443 ssl default_server;
            # listen [::]:443 ssl default_server;
            #
            # Note: You should disable gzip for SSL traffic.
            # See: https://bugs.debian.org/773332
            #
            # Read up on ssl_ciphers to ensure a secure configuration.
            # See: https://bugs.debian.org/765782
            #
            # Self signed certs generated by the ssl-cert package
            # Don't use them in a production server!
            #
            # include snippets/snakeoil.conf;
    
            root /var/www/html;
            # Add index.php to the list if you are using PHP
            index index.html index.htm index.nginx-debian.html;
    
            server_name abc.leo.ai;
    
            location / {
                    # First attempt to serve request as file, then
                    # as directory, then fall back to displaying a 404.
                    try_files $uri $uri/ =404;
                    proxy_pass http://ip3:7000;
                    proxy_set_header X-Forwarded-Proto http;
            }
    
            # Law Extractor
            location /lawex-api/ {
                    proxy_pass http://ip3:7001/;
                    proxy_set_header X-Forwarded-Proto http;
            }
    
            # location /
    
    
            # pass PHP scripts to FastCGI server
            #
            #location ~ \.php$ {
            #       include snippets/fastcgi-php.conf;
            #
            #       # With php-fpm (or other unix sockets):
            #       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
            #       # With php-cgi (or other tcp sockets):
            #       fastcgi_pass 127.0.0.1:9000;
            #}
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /\.ht {
            #       deny all;
            #}
    }
    # Virtual Host configuration for example.com
    #
    # You can move that to a different file under sites-available/ and symlink that
    # to sites-enabled/ to enable it.
    #
    #server {
    #       listen 80;
    #       listen [::]:80;
    #
    #       server_name example.com;
    #
    #       root /var/www/example.com;
    #       index index.html;
    #
    #       location / {
    #               try_files $uri $uri/ =404;
    #       }
    #}
    
        
  6. Go to firewall pfsense ip5 at browser, edit Services/DNS_Resolver/Custom_options, add 'local-data: "abc.leo.ai A ip3"'.
  7. Refresh nginx. sudo nginx -s reload
  8. Set up ssh tunnel between aws ip2 and ip4. ssh -i AWS_Linux.pem -R 7000:ip4:7000 ubuntu@ip2
  9. Set up Flask with same ip4:7000.

References


  1. How to Set Up a Proxy in Windows 10
  2. Github - xcp-ng/xenadmin