Skip to content

Instantly share code, notes, and snippets.

@nobuh
Created August 26, 2014 02:17
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 nobuh/7ca4b0af0bf2e599d586 to your computer and use it in GitHub Desktop.
Save nobuh/7ca4b0af0bf2e599d586 to your computer and use it in GitHub Desktop.
Zone Apex / Naked Domain / Root Domain redirect to the www subdomain by nginx
# Zone Apex / Naked Domain / Root Domain redirect to the www subdomain by nginx
# Here is a part of nginx config file
#
# For example on Debian 6 (Squeeze)
# /etc/nginx/site-available/default
#
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name your.domain;
rewrite ^/(.*) http://www.your.domain/$1 permanent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment