Skip to content

Instantly share code, notes, and snippets.

@taddev
Last active January 25, 2024 14:56
Show Gist options
  • Save taddev/8872330 to your computer and use it in GitHub Desktop.
Save taddev/8872330 to your computer and use it in GitHub Desktop.
NGINX Reverse proxy settings to Github pages
server {
listen 80 default_server;
listen [::]:80 ipv6only=on default_server;
server_name splunk.net blog.splunk.net www.splunk.net .taddevries.com;
access_log /var/log/nginx/blog.access_log main;
error_log /var/log/nginx/blog.error_log info;
return 301 https://blog.splunk.net;
}
server {
listen 443 default_server;
listen [::]:443 ipv6only=on default_server;
server_name blog.splunk.net;
ssl on;
ssl_certificate /etc/nginx/ssl/2013_blog_bundle.crt;
ssl_certificate_key /etc/nginx/ssl/splunk_4096.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security max-age=31536000;
add_header X-Frame-Options DENY;
access_log /var/log/nginx/blog.secure.access_log main;
error_log /var/log/nginx/blog.secure.error_log info;
client_max_body_size 4m;
location / {
proxy_pass http://taddevries.github.io;
proxy_redirect default;
proxy_buffering off;
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-Protocol $scheme;
}
location /wp/64bit-putty {
return 301 https://blog.splunk.net/64bit-putty;
}
}
@sdvgt
Copy link

sdvgt commented Dec 14, 2015

Sorry mmm... Where do you add this file to work?

@katopz
Copy link

katopz commented Apr 11, 2016

nginx: [emerg] "proxy_redirect default" cannot be used with "proxy_pass" directive with variables

@galek
Copy link

galek commented Nov 1, 2020

Hello, I tried using it, but got 404 (I try show site content on main domain without redirect to github);

Where I wrong? (Main difference from you - I not use SSL)

EDIT:
All is fine, I just add CNAME in the repository settings - after it, I got it is works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment