Created
February 28, 2019 20:03
-
-
Save sr3d/2fe8f006d3f71e96d1f65f0cbfd88b44 to your computer and use it in GitHub Desktop.
Alternative to ngrok with Permanent subdomain using Nginx, SSL, and reverse SSH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nginx configuration file: | |
# /etc/nginx/sites-available/dev.mydomain.com | |
# This block redirects non-ssl traffic to the ssl-version | |
server { | |
if ($host = dev.mydomain.com) { # replace with your mydomain | |
return 301 https://$host$request_uri; | |
} | |
listen 80 ; | |
listen [::]:80 ; | |
server_name dev.mydomain.com; # replace with your domain | |
return 404; | |
} | |
# Main server configuration block | |
server { | |
server_name dev.mydomain.com; # replace with your domain | |
listen [::]:443 ssl; | |
listen 443 ssl; | |
ssl_certificate /etc/letsencrypt/live/dev.mydomain.com/fullchain.pem; # replace with certbot line | |
ssl_certificate_key /etc/letsencrypt/live/dev.mydomain.com/privkey.pem; # replace with certbot line | |
include /etc/letsencrypt/options-ssl-nginx.conf; | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; | |
location / { | |
proxy_pass http://127.0.0.1:30000; # use a port that you like. 30000 is a good one. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment