What ServerAlias for my Subdomain?
This is my subdomain: subdomain.example.com that want to use for a very simple rail app.
This is my .conf file:
# domain: subdomain.example.com
# public: /var/www/subdomain.example.com/public_html/
<virtualhost *:80=""># Admin email, Server Name (domain name), and any aliases
ServerAdmin webmaster@example.com
ServerName www.subdomain.example.com
ServerAlias subdomain.example.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/subdomain.example.com/public_html
<directory var="" www="" subdomain.example.com="" public_html=""># Log file locations
LogLevel warn
ErrorLog /var/www/subdomain.example.com/log/error.log
CustomLog /var/www/subdomain.example.com/log/access.log combined</directory></virtualhost>
The question is: the ServerAlias must be "subdomain.example.com" OR "example.com"?
And please confirm, this setting is independent if i manage my domains DNS from "Linode DNS Manager" OR from my "Registrar DNS Panel"?
2 Replies
if you want to create subdomain it's better just create subdomain.example.com, it think if you use
serveralias is just optional you just need ServerName subdomain.example.com if you want to create subdomain.example.com
so the conf is:
ServerAdmin
ServerName subdomain.example.com
Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/subdomain.example.com/public_html
LogLevel warn
ErrorLog /var/www/subdomain.example.com/log/error.log
CustomLog /var/www/subdomain.example.com/log/access.log combined
@jessicarey:
so why you use "
www.subdomain.example.com " ?if you want to create subdomain it's better just create subdomain.example.com, it think if you use
http://www.subdomain.example.com it's subdomain in subdomain.serveralias is just optional you just need ServerName subdomain.example.com if you want to create subdomain.example.com
so the conf is:
# Admin email, Server Name (domain name), and any aliases ServerAdmin
webmaster@example.com ServerName subdomain.example.com
Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/subdomain.example.com/public_html
# Log file locations LogLevel warn
ErrorLog /var/www/subdomain.example.com/log/error.log
CustomLog /var/www/subdomain.example.com/log/access.log combined