My goal is to use GitHub Pages and also benefit from their CDN, without having to use a third-party DNS host that supports DNS ALIAS record types (or ANAME - neither are accepted standards). I want to know how they do it, can anyone explain please?
We have many questions here about DNS aliasing with CNAME records, but in this particular situation I can't CNAME the naked domain to username.github.io
.
If I do this with Apache or Nginx to get www.example.com working as a GitHub Page, does it work and do I break anything like email?
Apache
<VirtualHost *:80>
ServerName example.com
Redirect 301 / http://username.github.io/
</VirtualHost>
Nginx
server {
server_name example.com;
return 301 http://username.github.io/;
}
The above assumes a CNAME for www => username.github.io and an A Record for the naked domain => one of my servers with the above configuration.