编辑Apache ssl.conf后重启失败:PassengerResolveSymlinks命令无效报错
Alright, let's tackle this Apache restart error head-on. The Invalid command 'PassengerResolveSymlinksInDocumentRoot' message is pretty clear: Apache doesn't recognize this directive because it belongs exclusively to Phusion Passenger—the module you're using to run Redmine (a Ruby-based app). Here's how to fix it step by step:
1. Check if the Passenger module is loaded in Apache
First, confirm whether Passenger is actually active in your Apache setup. Run this command to list loaded modules:
sudo apache2ctl -M | grep passenger
If you get no output at all, that means the Passenger module isn't loaded—this is the most likely culprit. You can also run Passenger's built-in validation tool to get more details:
sudo passenger-config validate-install
2. Enable the Passenger module (if it's missing)
Passenger should have created configuration files in /etc/apache2/mods-available/ when you installed it—look for passenger.load and passenger.conf. Enable the module with these commands:
sudo a2enmod passenger sudo systemctl restart apache2
If the restart still fails, open /etc/apache2/mods-available/passenger.conf and double-check the module path settings. They should look something like this (adjust paths to match your system):
LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini PassengerDefaultRuby /usr/bin/ruby
You can get the correct PassengerRoot path by running passenger-config --root.
3. Audit your new Location configuration
Since the error popped up right after you added a new Location block in ssl.conf, take a close look at that section:
- Did you accidentally add
PassengerResolveSymlinksInDocumentRootto a Location that doesn't serve your Redmine app? This directive only belongs in blocks where Passenger is managing the application—if it's in a regular static file Location, just delete the line. - Double-check for typos! Apache directives are case-sensitive, so make sure it's exactly
PassengerResolveSymlinksInDocumentRoot(no missing letters or wrong capitalization).
A valid usage for Redmine would look like this:
<Location /redmine> PassengerResolveSymlinksInDocumentRoot on # Your other Redmine Passenger configs here </Location>
4. Validate Apache config syntax before restarting
Always check for syntax errors before trying to restart Apache—this saves you from unnecessary downtime:
sudo apache2ctl configtest
If you see Syntax OK, then go ahead and restart the service:
sudo systemctl restart apache2
Bonus: Fix module path mismatches after updates
If you recently updated Passenger or your Ubuntu system, the module path might have changed. Re-run the Passenger Apache module installer to refresh the configuration:
sudo passenger-install-apache2-module
Follow the on-screen prompts to update your Apache config files with the correct paths.
内容的提问来源于stack exchange,提问作者LKKP4ThX

