500 internal server error in ruby on rails

2019-07-20 04:36发布

问题:

I am deploying my ruby 3.2.6 project using passenger 3.0.17 . My httpd.conf file is:

<VirtualHost *:80>
      ServerName test.com
      DocumentRoot /var/www/html/test/public
      RackBaseURI /var/www/html/test/public
      <Directory /var/www/html/test/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
      </Directory>
      PassengerMinInstances 1
</VirtualHost>

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.17
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby
RailsSpawnMethod conservative

When i deploy my project by starting passenger, it works fine but while uploading images to server, it throws 500 internal error. I am unable to find the reason for this error and also this error is temporary and is removed after i restart passenger by deleting the cache saved in my ruby project.

I am new to ruby on rails and unable to figure out the reason of this error and why it disappears on restarting passenger.

Please guide me Thanks in advance

回答1:

Read the Apache error log file. If Phusion Passenger does not display an error message in the browser, then it will print the error message to the log file.



回答2:

Use:

passenger-status

If there is an error you probably don't have the gam installed for your ruby version

Use:

gem install passenger

Then:

passenger-install-apache2-module

Check if passenger running with:

passenger-memory-stats

or

passenger-status

Follow the instructions on Phusion Passenger

You may need to modify mods-available/passenger.conf to point to an rbenv or rvm ruby interpreter , not us/bin/ruby



回答3:

Had the same problem, found out that was having multiple passengers running by checking passenger-status. Killed them all then run passenger passenger start again on the , NOT the root user.