Skip to content

Instantly share code, notes, and snippets.

@iczero
Last active August 13, 2020 23:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iczero/7cd7c90e9785449eeff7251be1ab3958 to your computer and use it in GitHub Desktop.
Save iczero/7cd7c90e9785449eeff7251be1ab3958 to your computer and use it in GitHub Desktop.
Sci-Hub nginx reverse proxy setup
# relevant parts of configuration
upstream scihub {
server 80.82.77.83:443;
server 80.82.77.84:443;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name sci-hub.yourdomain.comt;
ssl_certificate sci-hub-cert;
ssl_certificate_key sci-hub-key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://scihub;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto "";
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass_request_headers on;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name ~^(?<subdomain>\w+)\.sci-hub\.yourdomain\.com$;
ssl_certificate sci-hub-cert;
ssl_certificate_key sci-hub-key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://$subdomain.sci-hub.tw:443;
proxy_http_version 1.1;
proxy_set_header Host $subdomain.sci-hub.tw;
proxy_set_header X-Forwarded-Proto "";
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass_request_headers on;
proxy_ssl_name $subdomain.sci-hub.tw;
proxy_ssl_server_name on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment