I was recently awarded the popular question badge for this question, so I thought it was about time I posted the answer. I'll just post the relevant parts of my conf files.
So in /etc/apache2/httpd.conf
I have the following:
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-3.0.7
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Also make sure to uncomment the following line:
Include /etc/apache2/extra/httpd-vhosts.conf
Then in /etc/apache2/extra/httpd-vhosts.conf
I have the following:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example.dyndns.org
DocumentRoot "/Users/Shared/rails/project/public"
<Directory /Users/Shared/rails/project/public>
AllowOverride all
Options -MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
After today I will not have access to this server. We don't use it anymore. Instead we use Heroku. So if it's not working for you, for some reason, or I've forgot some vital part of the configuration, I will not be able to help you. It may be outdated and I don't know if it works with newer versions of passenger. Also the server was using Mac OS X Snow Leopard, so it may not work with other versions of OS X. However, my guess is that it hasn't changed all that much and that most of this is still valid.
I also want another disclaimer. This may not be the safest configuration. I don't understand all the options, but it seems to be very allowing. I had a colleague help me with the configuration and this is simply the first version of the configuration that we got working. We did not care much about the security since it was only a dev server and not production.
If you have any suggestions on how to improve the configuration, please feel free to post those. Even though I will not have any use for those, others still might. After all, this is a popular question.
You've attached a Name-based VirtualHost (by using ServerName dev.localhost
) to port 80 on all interfaces, but you haven't set a default VirtualHost so it's using the main DocumentRoot configuration (probably in /etc/apache2/conf/apache2.conf
). Two options:
- Replace
*:80
with _default_:80
and remove the ServerName
option, meaning this VirtualHost will handle all connections on port 80 regardless of the Host:
header provided.
- Add another
sites-enabled
file with a _default_:80
VirtualHost that points to a DocumentRoot
containing a page informing users there is no site configured on this hostname. This approach is forward-looking if you plan to deploy multiple name-based VirtualHosts.
Best Answer
200ms doesn't seem that terrible. The 'request queuing' metric is the measure of time between your web server logs the request and the moment the New Relic agent loads (after
before_filters
). The way this is measured can make it seem like there is a problem, when one doesn't exist. Your latency is nice and even, with no spikes that would indicate you are running out of workers or starving for resources/CPU. You can usewatch passenger-status
to check this. You can also double check the server's resource usage locally using Linux utilities:top, iotop, vmstat, sar (systat)
Still want to hunt for optimizations? Check out anything that executes before the New Relic agent. Possible pain points:
It will take some digging. Good luck!