Wrongly installed Nginx before Passenger for Ruby on Rails productions servers

Note: Although this question has to do with server installations, it has to do with development and production environments that confuse beginners like myself.

Being new to setting up servers, after some research I settled in installing NginX for my Ruby on Rails server. Following some HowTo's for Apache, as well as some HowTo's on how to install NginX in Ubuntu, I installed NginX by running:

$ sudo aptitude install nginx

(Note: I installed the dependencies first). Everything worked, and NginX was successfully serving its default page.

Subsequently, I found this very good post on how to install MySQL, Ruby, Passenger and NginX, which was what I wanted to do.

To my dismay I realised that I had to install NginX using Passenger, by running:

$ sudo passenger-install-nginx-module

In the hopes that it would overwrite my previous installation of NginX, I ran the command, and it resulted in my having 2 installations of NginX: One that successfully serves my pages from /etc/nginx/ (the original installation), and one that is installed in /opt/nginx/ (The Phusion-Passenger installation - Note: I have not yet completed the instructions in the aforementioned post to get this installation to work).

How do I fix this so that I only have the Phusion-Passenger installation on my server?


After many hours of research, I realised that the simplest answer was the right one.

I ran:

$ sudo /etc/init.d/nginx stop    
$ sudo aptitude purge nginx

which stops the server and removes the installation that was installed using

$ sudo aptitide install nginx

I then had to manually remove all the files that were left behind in /etc/nginx/ by running:

$ sudo rm -r /etc/nginx/

I am not sure whether this affected the NginX installation that was installed using Passenger, but just to be safe I ran the following again:

$ sudo passenger-install-nginx-module

I then completed the instructions from the post I was following, and I successfully got NginX to serve its default page.

I had a great deal of trouble and confusion with this, so I made this post in the hope that it helps more beginners like myself.

链接地址: http://www.djcxy.com/p/32456.html

上一篇: 在端口80上启动一个新站点

下一篇: 用于Ruby on Rails制作服务器的Passenger之前错误地安装了Nginx