2023-07-05 18:09:06 -07:00
|
|
|
# 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.
|
|
|
|
|
2023-07-05 20:02:50 -07:00
|
|
|
## Instructions ##
|
|
|
|
# Add this without the comment to your /etc/hosts to test that it is working,
|
2023-07-08 12:34:54 -07:00
|
|
|
# YOUR_DOCKER_SERVER_IP proxy.example.com
|
2023-07-05 20:02:50 -07:00
|
|
|
# If testing locally on a workstation,
|
2023-07-08 12:34:54 -07:00
|
|
|
# 127.0.0.1 proxy.example.com
|
2023-07-05 20:02:50 -07:00
|
|
|
# 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,
|
2023-07-08 12:34:54 -07:00
|
|
|
# curl --insecure proxy.example.com
|
2023-07-08 11:31:37 -07:00
|
|
|
# You should see activity in the container log as well as the contents of the
|
2023-07-08 12:34:54 -07:00
|
|
|
# proxied website in the terminal, NOT proxy.example.com. If using a browser then you
|
|
|
|
# should notice that the URL is still proxy.example.com but the website is correct.
|
2023-07-05 20:02:50 -07:00
|
|
|
|
2023-07-05 18:09:06 -07:00
|
|
|
# Force HTTPS
|
|
|
|
server {
|
|
|
|
|
|
|
|
listen 80;
|
2023-07-08 12:34:54 -07:00
|
|
|
server_name proxy.example.com;
|
2023-07-05 18:09:06 -07:00
|
|
|
|
2023-07-21 22:23:46 -07:00
|
|
|
location /.well-known/acme-challenge/ {
|
|
|
|
default_type "text/plain";
|
|
|
|
root /etc/nginx/letsencrypt/;
|
|
|
|
}
|
|
|
|
|
2023-07-05 18:36:10 -07:00
|
|
|
# Redirect to a more secure protocol.
|
2023-07-21 22:23:46 -07:00
|
|
|
location / {
|
|
|
|
return 301 https://$host$request_uri;
|
|
|
|
}
|
2023-07-05 18:09:06 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-07-05 18:36:10 -07:00
|
|
|
# Serve Resource
|
2023-07-05 18:09:06 -07:00
|
|
|
server {
|
|
|
|
|
2023-07-05 20:02:50 -07:00
|
|
|
listen 443 ssl;
|
2023-07-08 12:34:54 -07:00
|
|
|
server_name proxy.example.com;
|
2023-07-05 18:09:06 -07:00
|
|
|
|
2023-07-05 20:02:50 -07:00
|
|
|
# The certs being used for the website.
|
2023-07-08 12:34:54 -07:00
|
|
|
ssl_certificate /etc/nginx/certs/proxy.example.com/fullchain.pem;
|
|
|
|
ssl_certificate_key /etc/nginx/certs/proxy.example.com/privkey.pem;
|
2023-07-05 18:09:06 -07:00
|
|
|
|
2023-07-21 22:23:46 -07:00
|
|
|
location /.well-known/acme-challenge/ {
|
|
|
|
default_type "text/plain";
|
|
|
|
root /etc/nginx/letsencrypt/;
|
|
|
|
}
|
|
|
|
|
2023-07-05 18:09:06 -07:00
|
|
|
# Send traffic to upstream server
|
|
|
|
location / {
|
2023-07-05 18:36:10 -07:00
|
|
|
## 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;
|
|
|
|
#
|
2023-07-09 16:02:47 -07:00
|
|
|
# If using an upstream server:
|
|
|
|
#proxy_pass http://example-proxy-site;
|
|
|
|
#
|
2023-07-05 18:36:10 -07:00
|
|
|
# If forwarding to an external source:
|
2023-07-08 12:10:37 -07:00
|
|
|
#proxy_pass https://website.name;
|
2023-07-05 18:36:10 -07:00
|
|
|
#
|
2023-07-08 11:31:37 -07:00
|
|
|
# Or alternatively, do it like the force of HTTPS if not your server.
|
2023-07-08 12:10:37 -07:00
|
|
|
#return 301 https://website.name/$request_uri;
|
2023-07-05 18:36:10 -07:00
|
|
|
|
2023-07-08 12:34:54 -07:00
|
|
|
# This should forward you from 'proxy.example.com' to a real site:
|
2023-07-05 20:02:50 -07:00
|
|
|
proxy_pass https://hyperling.com;
|
2023-07-05 18:09:06 -07:00
|
|
|
}
|
|
|
|
|
2023-07-05 18:11:49 -07:00
|
|
|
}
|