Skip to content

Instantly share code, notes, and snippets.

@linnil1
Last active July 23, 2018 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linnil1/b5079418770b1b8bc8bbfe94801e857d to your computer and use it in GitHub Desktop.
Save linnil1/b5079418770b1b8bc8bbfe94801e857d to your computer and use it in GitHub Desktop.
Redirect
docker run -it --rm -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro -v $(pwd)/certs:/certs:ro -v $(pwd)/log:/var/log/nginx -p 80:80 -p 443:443 nginx
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
#gzip on;
server {
server_name my.domain.ntu.edu.tw;
listen 80;
listen 443 ssl;
ssl_certificate /certs/fullchain.pem;
ssl_certificate_key /certs/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
rewrite ^/(.*)$ https://anothersite/ redirect;
#charset koi8-r;
}
}
# test for proxy abuse
# https://wiki.apache.org/httpd/ProxyAbuse
# CONNECT
curl -x https://my.domain.ntu.edu.tw -L https://my.domain.ntu.edu.tw
# GET
telnet my.domain.ntu.edu.tw 443
GET my.domain.ntu.edu.tw HTTP/1.1
Host: my.domain.ntu.edu.tw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment