I've got an Apache question here.
For my entire career as a developer, I've been restarting Apache like this:
sudo /etc/init.d/apache2 restart
I just today deployed my first Rails application, but I was having trouble getting Apache to restart on the host machine. When I tried it that way, Apache would try to restart, but would ultimately hang.
This, however, worked fine:
sudo apachectl restart
What are the differences between these two techniques? I had assumed that the latter was, at best, "syntactic sugar" for the first, but that must not be the case, given that the latter worked while the former did not.
If it's relevant (and I suspect it may be), this Rails application uses Phusion Passenger. My prior development experience (whereby the former method works fine) is mostly with PHP. I'm pretty new to Rails.
The server in question is runs Ubuntu 11.04 (Natty).
This method uses your Linux distro's init scripts to restart the process. These scripts are run at boot time to start apache.
This method uses the apachectl control program. In almost every occasion I would recommend the use of apachectl the to maniuplate the apache daemon. You have finer grained control over how the process restarts (see graceful vs. restart), configuration validation options and a way to get status information.
The main difference between using the init scripts to restart apache and apachectl is that apachectl is specifically designed to allow administators to control apache whereas the init scripts are designed as a generalized way for Unixes to start processes after the kernel and init daeamon have been loaded.
EDIT: Unfortunantly, I have no idea how to address your issue with Rails or Phusion Passenger. Try looking through your Apache logs for clues.