Skip to content

Instantly share code, notes, and snippets.

@stevenyap
Created February 21, 2014 08:51
Show Gist options
  • Select an option

  • Save stevenyap/9130876 to your computer and use it in GitHub Desktop.

Select an option

Save stevenyap/9130876 to your computer and use it in GitHub Desktop.
Apache Configuration and more

Subdomain setup

# Note that you may want to uncomment NameVirtualHost *:80 in /etc/httpd/conf/httpd.conf to unset warnings for conflicted *:80

Listen 801
Listen 802
Listen 803
Listen 804

NameVirtualHost *:80

<VirtualHost *:801 *:80>
  ServerName staging.api.depot.com.sg

  # Note that current is the folder created by Capistrano
  # It is created as a sym-link to /releases which contains the latest codes
  DocumentRoot /var/www/depot/staging/current/public

    # Set the rails environment
    RailsEnv staging

  <Directory /var/www/depot/staging/current/public>
    # This relaxes Apache security settings.
    AllowOverride all
    # MultiViews must be turned off.
    Options -MultiViews
      Order Allow,deny
      Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:802 *:80>
  ServerName api.depot.com.sg

  # Note that current is the folder created by Capistrano
  # It is created as a sym-link to /releases which contains the latest codes
  DocumentRoot /var/www/depot/production/current/public

    # Set the rails environment
    RailsEnv production

  <Directory /var/www/depot/production/current/public>
    # This relaxes Apache security settings.
    AllowOverride all
    # MultiViews must be turned off.
    Options -MultiViews
      Order Allow,deny
      Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:803 *:80>
  ServerName staging.example.com.sg

  # Note that current is the folder created by Capistrano
  # It is created as a sym-link to /releases which contains the latest codes
  DocumentRoot /var/www/example/staging/current/public

    # Set the rails environment
    RailsEnv staging

  <Directory /var/www/example/staging/current/public>
    # This relaxes Apache security settings.
    AllowOverride all
    # MultiViews must be turned off.
    Options -MultiViews
      Order Allow,deny
      Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:804 *:80>
  ServerName www.example.com.sg

  # Note that current is the folder created by Capistrano
  # It is created as a sym-link to /releases which contains the latest codes
  DocumentRoot /var/www/example/production/current/public

    # Set the rails environment
    RailsEnv production

  <Directory /var/www/example/production/current/public>
    # This relaxes Apache security settings.
    AllowOverride all
    # MultiViews must be turned off.
    Options -MultiViews
      Order Allow,deny
      Allow from all
  </Directory>
</VirtualHost>

See Apache log on CentOS 6.4

cat /var/log/httpd/error_log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment