I've the following example given to me to set up rails on CentOS with apache / passenger:

<virtualhost *:80>
RailsEnv development
ServerName app.com
ServerAlias www.app.com
DocumentRoot /var/www/html/final_app/public
<directory /var/www/html/final_app/public>
AllowOverride all
Options -MultiViews

Are ServerName / ServerAlias required? I want the site to be accesssed by IP and port, like 123.123.321:1337.


Problem resolved itself. Apache will set as ServerName if it isn't resolved.

| improve this answer | |
  • That's actually not what apache does. What happens is that requests that don't match a servername are always handled by the first virtual host. So typing localhost or in your browser will in this case lead to the default virtual host being served. – Krist van Besien Jun 5 '13 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.