Last active
September 20, 2019 13:42
-
-
Save danielledeleo/ebda33fefe4032773594 to your computer and use it in GitHub Desktop.
Nginx tilde.club clone conf
This file contains hidden or 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
# my humble homage to tilde.club | |
server { | |
listen 80; | |
# to disallow anything other than what's below (like a direct IP) | |
server_name _; | |
} | |
server { | |
listen 80; | |
server_name example.com | |
# no www access without www. A naked hostname is for SSH/Telnet. | |
return 301 http://www.example.com$request_uri; | |
} | |
server { | |
listen 80; | |
server_name www.example.com; | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
#charset koi8-r; | |
#access_log /var/log/nginx/log/host.access.log main; | |
location / { | |
# redirect [domain.com]/ to [domain.com]/~tilde/ | |
return 301 http://$host/~tilde$request_uri; | |
} | |
# matches [example.com]/~[username] | |
# and maps it to /home/[username] | |
location ~ ^/~([\-\_\w]*)(.*)$ { | |
alias /home/$1/public_html$2; | |
} | |
# error_page 404 /404.html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment