Skip to content

Instantly share code, notes, and snippets.

@danielledeleo
Last active September 20, 2019 13:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielledeleo/ebda33fefe4032773594 to your computer and use it in GitHub Desktop.
Save danielledeleo/ebda33fefe4032773594 to your computer and use it in GitHub Desktop.
Nginx tilde.club clone conf
# 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