Quantcast
Channel: Allow non-root process to bind to port 80 and 443? - Super User
Viewing all articles
Browse latest Browse all 8

Answer by Michael Cole for Allow non-root process to bind to port 80 and 443?

$
0
0

What is the simplest thing that could possibly work?

A reverse proxy. Nginx is simpler than iptables (for me anyways). Nginx also offers "ssl termination".

sudo apt install nginxsudo service nginx start# Verify it's workingcurl http://localhost# make certssudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/cert.key -out /etc/nginx/cert.crtsudo nano /etc/nginx/conf.d/devserver.conf 

add this content

server {    listen 80;    return 301 https://$host$request_uri;}server {    listen 443;    server_name www.example.com;    ssl_certificate           /etc/nginx/cert.crt;    ssl_certificate_key       /etc/nginx/cert.key;    ssl on;    location / {      proxy_set_header        Host $host;      proxy_set_header        X-Real-IP $remote_addr;      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;      proxy_set_header        X-Forwarded-Proto $scheme;      proxy_pass          http://localhost:8080;    }}

The restart the server:

sudo service nginx restart

Configure DNS: A record for www.example.com -> 127.0.0.1

# Test it out:curl --insecure --verbose https://www.example.com

Viewing all articles
Browse latest Browse all 8

Trending Articles