Last active
March 7, 2020 09:12
-
-
Save a60814billy/b3d0e7b655e1243690dad0373c3b1973 to your computer and use it in GitHub Desktop.
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
<!-- /var/www/main-site/index.html --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Main Product Site</title> | |
<body> | |
<h1>Hello !</h1> | |
<script> | |
document.write(location.search); | |
</script> | |
</body> | |
</html> |
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/sites-available/main.conf | |
server { | |
server_name www.product.com; | |
location / { | |
root /var/www/main-site; | |
} | |
} |
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/sites-available/reseller.conf | |
include reseller_map.conf; | |
server { | |
server_name md.example.com user1.example.com; | |
rewrite ^(.*)$ http://www.product.com$1?proxy=$seller_id last; | |
return 302; | |
} | |
server { | |
server_name apple.example.com; | |
server_name orange.example.com; | |
rewrite ^(.*)$ http://www.product.com$1?proxy=$seller_id last; | |
return 302; | |
} |
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/reseller_map.conf | |
map $http_host $seller_id { | |
hostnames; | |
default "0"; | |
md.example.com "md001"; | |
user1.example.com "user"; | |
apple.example.com "apple-pen"; | |
orange.example.com "org"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment