views:

164

answers:

1

I just need some clarification on a couple of files.

My site has an admin subdomain and SSL in addition to the normal *:80 details found in the virtual hosts.

My question(s): Do I need to specify a 1) ServerName and 2) DocumentRoot in: /etc/apache2/apache2.conf?

I currently enable my site from this directory: /etc/apache2/sites-available/site

Here are the contents of my site file in the above directory (/etc/apache2/sites-available/site):

<VirtualHost *:80>
  ServerName  www.site.com
  ServerAlias www.site.com

  DocumentRoot /home/user/public_html/site/current/public
  RailsAllowModRewrite off
  <directory "/home/user/public_html/site/current/public">
    Order allow,deny
    Allow from all
  </directory>
</VirtualHost>

<VirtualHost *:80> 
  ServerName www.site.com 
  ServerAlias admin.site.com
  DocumentRoot /home/user/public_html/site/current/public
  RailsAllowModRewrite off
  <directory "/home/user/public_html/site/current/public">
    Order allow,deny
    Allow from all
  </directory>
</VirtualHost>

<VirtualHost *:443>
  ServerName www.site.com
  ServerAlias www.site.com 

  # SSL releated
  SSLEngine on
  SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
  SSLCertificateFile /path/to/site.com.crt
  SSLCertificateChainFile /path/to/bundle.crt
  SSLCertificateKeyFile /path/to/site.key

  # Used by rails
  RequestHeader set X_FORWARDED_PROTO "https"
</VirtualHost>

Do you see anything wrong?

A: 

Looks like I was missing a DocumentRoot in my SSL VirtualHost. Fixed! (also cleaned up those aliases)

Steve