From a122f651ac166c1f998d20ff473b46298b4c679a Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sat, 8 Jul 2023 12:34:33 -0700 Subject: [PATCH] Add an HTML example. --- .../config/conf.d/html.example.com | 66 +++++++++++++++++++ .../config/html/html.example.com/index.html | 8 +++ 2 files changed, 74 insertions(+) create mode 100644 Config/ReverseProxy/config/conf.d/html.example.com create mode 100644 Config/ReverseProxy/config/html/html.example.com/index.html diff --git a/Config/ReverseProxy/config/conf.d/html.example.com b/Config/ReverseProxy/config/conf.d/html.example.com new file mode 100644 index 0000000..8e3de1c --- /dev/null +++ b/Config/ReverseProxy/config/conf.d/html.example.com @@ -0,0 +1,66 @@ +# 2022-10-05 Hyperling +# A dummy test file since true scripts are being kept private. +# This should help anyone understand how the project is being used. + +## Instructions ## +# Add this without the comment to your /etc/hosts to test that it is working, +# YOUR_DOCKER_SERVER_IP example.com +# If testing locally on a workstation, +# 127.0.0.1 example.com +# Then to test, first start the container, +# cd $DOCKER_HOME/Config/ReverseProxy && docker compose build && docker compose up -d +# Then from the system with the modified /etc/hosts, +# curl --insecure example.com +# You should see activity in the container log as well as the contents of the +# proxied website in the terminal, NOT example.com. If using a browser then you +# should notice that the URL is still example.com but the website is correct. + +# Force HTTPS +server { + + listen 80; + server_name example.com; + + # Redirect to a more secure protocol. + return 301 https://$host$request_uri; + +} + +# Serve Resource +server { + + listen 443 ssl; + server_name example.com; + + # The certs being used for the website. + ssl_certificate /etc/nginx/certs/example.com/fullchain.pem; + ssl_certificate_key /etc/nginx/certs/example.com/privkey.pem; + + # Send traffic to upstream server + location / { + proxy_set_header X-Forwarded-Proto https; + + # These cause "400 Bad Request Request Header Or Cookie Too Large"? + #proxy_set_header Host $host; + #proxy_set_header X-Real-IP $remote_addr; + #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + ## General format is PROTOCOL://SERVER:PORT. For example: + # + # If using a domain name: + #proxy_pass http://YOUR_SERVER_NAME:8080; + # + # If using an IP address: + #proxy_pass http://192.168.1.80:8080; + # + # If forwarding to an external source: + #proxy_pass https://website.name; + # + # Or alternatively, do it like the force of HTTPS if not your server. + #return 301 https://website.name/$request_uri; + + # This should forward you from 'example.com' to a real site: + proxy_pass https://hyperling.com; + } + +} diff --git a/Config/ReverseProxy/config/html/html.example.com/index.html b/Config/ReverseProxy/config/html/html.example.com/index.html new file mode 100644 index 0000000..d09b5d8 --- /dev/null +++ b/Config/ReverseProxy/config/html/html.example.com/index.html @@ -0,0 +1,8 @@ + +
+ Example HTML Website +
+ +

Welcome to the example HTML website!

+

This means the reverse proxy is successfully serving static HTML content. Yay!

+