Technology Insights

503 Service Unavailable Error After Switching Litespeed Rails Site From Production Mode To Staging Mode

Earlier I switched one of the Litespeed web server virtual hosts from production mode to staging mode and after gracefully restarting rails was receiving a 503 Service Unavailable error. Initially I thought that maybe Litespeed had to be restarted completely instead of just a graceful restart but that produced the same results. Below I describe the errors including errors in the Litespeed logs as well as how to resolve the issue which ended up being a silly mistake on my part.

Technology Insights

How to Start Ruby on Rails in Development Mode with LiteSpeed Web Server

Starting ruby on rails in development mode with Litespeed is easy. You need to make sure that your database.yml is configured to handle development mode as well. Follow the steps below to start Litespeed running Ruby on Rails in development mode.

Please note both cofiguration settings listed in step one which include setting this to be the default for future virtual hosts and configuring current virtual hosts to restart in development mode.

Technology Errors

‘Can’t connect to local MySQL server through socket’ in Rails 2.2.2

Error in Rails 2.2.2
Status: 500 Internal Server Error
Can’t connect to local MySQL server through socket ‘/opt/local/var/run/mysqld/mysqld.sock’ (2)

Add the socket location to database.yml

ruby

  1. production:
  2. adapter: mysql
  3. encoding: utf8
  4. database: example_production
  5. username: root
  6. password: passwordie
  7. pool: 5
  8. socket: '/var/lib/mysql/mysql.sock'
  9. host: 127.0.0.1

Reference: database.yml in Ruby on Rails