Last active
March 28, 2023 06:55
-
-
Save alswl/afaae53e85f9ea4b4fe8786af339b99e to your computer and use it in GitHub Desktop.
Simple proxy on Nginx for Github(and Github user content)
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
# /etc/nginx/.github.test.com.htpasswd | |
# htpasswd -nb user password | |
# PLEASE USE YOUR OWN PASSWORD | |
user:$apr1$zv2GRYuf$vknySgxsj3DfOav6cdRCv. |
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
# /etc/nginx/conf.d/github.test.com.conf | |
server { | |
listen 80; | |
# mirror for github.com | |
server_name github.test.com; | |
access_log off; | |
auth_basic "Restricted Content"; | |
auth_basic_user_file /etc/nginx/.github.test.com.htpasswd; | |
location / { | |
proxy_pass https://github.com/; | |
proxy_redirect https://objects.githubusercontent.com/ https://ghouc.test.com/; | |
proxy_set_header X-Real-IP $remote_addr; | |
} | |
} | |
server { | |
listen 80; | |
# mirror for raw.githubusercontent.com | |
server_name ghruc.test.com; | |
access_log off; | |
auth_basic "Restricted Content"; | |
auth_basic_user_file /etc/nginx/.github.test.com.htpasswd; | |
location / { | |
proxy_pass https://raw.githubusercontent.com/; | |
proxy_set_header X-Real-IP $remote_addr; | |
} | |
} | |
server { | |
listen 80; | |
# mirror for objects.githubusercontent.com | |
server_name ghouc.test.com; | |
access_log off; | |
auth_basic "Restricted Content"; | |
# no auth for objects, using Github S3 links with time expired | |
location / { | |
proxy_pass https://objects.githubusercontent.com/; | |
proxy_set_header X-Real-IP $remote_addr; | |
} | |
} | |
# vim: set ft=nginx sw=2 et: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment