Skip to content

Instantly share code, notes, and snippets.

@cubarco
Last active April 9, 2016 13:20
Show Gist options
  • Save cubarco/08e99fbf316a435b7935727810e40458 to your computer and use it in GitHub Desktop.
Save cubarco/08e99fbf316a435b7935727810e40458 to your computer and use it in GitHub Desktop.
Nginx config file for DuckDuckGo mirror.
server {
listen [::]:80;
listen 80;
server_name duck.domain.com;
return 302 https://duck.domain.com/$uri;
}
server {
listen [::]:443;
listen 443;
server_name duck.domain.com;
ssl on;
ssl_certificate /path/to/duck.crt;
ssl_certificate_key /path/to/duck.key;
sub_filter_types text/html text/css application/x-javascript text/xml;
access_log off;
location / {
proxy_pass https://duckduckgo.com;
proxy_set_header Host duckduckgo.com;
proxy_set_header Accept-Encoding "";
proxy_set_header Referer "";
sub_filter "duckduckgo.com" "duck.domain.com";
sub_filter_once off;
}
}
server {
listen [::]:443;
listen 443;
server_name images.duck.domain.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/images.duck.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/images.duck.domain.com/privkey.pem;
access_log off;
location / {
proxy_pass https://images.duckduckgo.com;
proxy_set_header Host images.duckduckgo.com;
}
}
server {
listen [::]:443;
listen 443;
server_name icons.duck.domain.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/icons.duck.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/icons.duck.domain.com/privkey.pem;
access_log off;
location / {
proxy_pass https://icons.duckduckgo.com;
proxy_set_header Host icons.duckduckgo.com;
}
}
server {
listen [::]:443;
listen 443;
server_name ac.duck.domain.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/ac.duck.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ac.duck.domain.com/privkey.pem;
access_log off;
location / {
proxy_pass https://ac.duckduckgo.com;
proxy_set_header Host ac.duckduckgo.com;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment