Ubuntu8.04 nginx mongrel mongrel_cluster erection Cluster Server



Engage in a day, and finally弄完, and also understand a number of slightly utuntu order.

Units 1 to set up nginx + mongrel servers, mongrel_cluster used to configure the cluster.
Benefited from the following articles. Thanks rushairer And slicehost

http://articles.slicehost.com/2008/5/27/ubuntu-hardy-nginx-rails-and-mongrels

http://forum.ubuntu.org.cn/viewtopic.php?f=63&t=82685&p=479103&hilit=mongrel + nginx +% E6% 9E% B6% E8% AE% BE # p479103

In my configuration, try to cluster several servers set up, including the Nets win machine, but also be able to run, but the efficiency do not know how to

Again to see if we can so that these servers share a mysql database on OK.

Quoted as follows:

=======
Input at terminals and run
sudo cp / etc / apt / sources.list / etc / apt / sources.list.backup (backup the current source list, so that when necessary to restore)
sudo gedit / etc / apt / sources.list (modified sources.list file in the source list)

I was elected Enorth's source, the specific source of the contents of the above reference U.S. Posts吧, they write well, or so go join it.

Deb Posts also mentioned http://archive.ubuntu.org.cn/ubuntu-cn/ feisty main restricted universe multiverse would like to add.

I too get more advanced knowledge of the 3D desktop, change subject, it seems less the result of what documents can not start, so give up. Flashy things, temporarily not interested in taking.

Bet, install Ruby RubyGems Rails Mongrel Nginx.
The source in Ubuntu7.10 have, so use Synaptic to install on the list, Ruby up to the election ruby1.8 and ruby1.8-dev.
However, like leaving a shortfall of things to add up sudo apt-get install libssl-dev (required)
sudo apt-get install libzlib-ruby rdoc ri irb (I do not recall election ruby Synaptic will then install these, and many had also nothing to write, will not be installed in duplicate)

The following re-installed to manage multiple Mongrel mongrel_cluster Service
sudo gem install daemons gem_plugin mongrel mongrel_cluster

Recall election there are ruby version of the compiler. If error is less ruby development kit installed.

Mogrel users set up sudo / usr / sbin / addusr mongrel
Mongrel password you

With rails set up at sites such as / home / abendas / www / www.abendas.com
Just now added to the site directory of the user's permissions you Mongrel sudo chown-R mongrel: mongrel / home / abendas / www.abendas.com /

Then set the site Mongrel configuration
cd / home / abendas / www / www.abendas.com
sudo mongrel_rails cluster:: configure-e development-p 8000-N 2-c / home / abendas / www.abendas.com /-a 127.0.0.1 - user

mongrel - group mongrel
Help-e development are under the rails of development mode, you can with other models to their own needs reform .- p 8000 they began to use the port number-N 2 are open Mongrel process quantity (I

Now opened two threads, each have a separate port, to the rear, that is, port 8000 and 8001 points were used to them)-c / home / abendas / www.abendas.com / site path

Trail-a 127.0.0.1 mongrel Services where the computer IP. - User mongrel - group mongrel attention are the two -, the user name and group that we have just set up the

Mongrel users.

At this time inside the site to generate a config file mongrel_clueter.yml, you can see there are how to write, and go back to their own convenience.

Job is to put the following configuration file into a unified place to come.
sudo mkdir / etc / mongrel_cluster
sudo ln-s / home / abendas / www / www.abendas.com / config / mongrel_cluster.yml / etc / mongrel_cluster / abendas.yml
Means from the site directory link to put YML file / etc / mongrel_cluster / under the re-naming is free, I was named the abendas.yml.

Below 7.04 is different from the place appeared to find mongrel_cluster,
sudo find /-name mongrel_cluster
Results / var/lib/gems/1.8/gems/mongrel_cluster-1.0.2/resources/mongrel_cluster found, I remember it was not the same as with 7.04.

Go into startup folder.
cd / etc / init.d /
sudo cp / var/lib/gems/1.8/gems/mongrel_cluster-1.0.2/resources/mongrel_cluster mongrel_cluster

Give it executable property
sudo chmod + x / etc / init.d / mongrel_cluster

And as a random start
sudo update-rc.d mongrel_cluster defaults

And we can start a bar? Sudo / etc / init.d / mongrel_cluster start
No response .....
2B phenomenon has happened ........
Show me mongrel_cluster code, each statement can not find the implementation of mongrel_cluster_ctl found ...
Suddenly
sudo find /-name mongrel_cluster_ctl
At / var/lib/gems/1.8/bin/mongrel_cluster_ctl

Then we
################################################## ##################
sudo ln-s / var/lib/gems/1.8/bin/mongrel_cluster_ctl / usr / bin /
################################################## ##################
And then sudo / etc / init.d / mongrel_cluster on ok, and this one place to start do not know, a heavy or wrong, so I think it is this version of the default installation mongrel_cluster

Setting missing link to put it / usr / bin / instead.

If the meter has to Mongrel account permissions to the directory at the site, or sites directory at / var / www, the mongrel8000.pid reported what may be an error, it is permission problem. To resolve it:)

Just now in the new legislation may have been installed in nginx, and very good.

Nginx configuration at / etc / nginx / nginx. Conf
There is a default which include / etc / nginx / sites-enabled / *;
Then go / etc / nginx / site-enabled it to find files to open

My configuration is as follows
Notes # behind the fight later, I do not know will not be affected, no comment on the removal of HA.

upstream abendas (
# Abendas re-named copy of a change of name is another group Mongrel site, pay attention to the port number.
server 127.0.0.1:8000;
server 127.0.0.1:8001;
)

server (
listen 80;
listen www.abendas.com:80;

server_name www.abendas.com;
# Add server_name www.abendas.cn; Is that many domain names point to the same site
access_log / var / log / nginx / localhost.access.log;

location / (
root / home / abendas / www / www.abendas.com / public;
# rails site directory public directory
index index.html index.htm;
)
location / (
proxy_pass http://abendas;
# Mongrel cluster with the corresponding names of up to
proxy_redirect off;
proxy_set_header Host $ host;
proxy_set_header X-Real-IP $ remote_addr;
proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
)
location ~ * ^. + \.

(jpg | jpeg | gif | png | ico | css | zip | tgz | gz | rar | bz2 | doc | xls | exe | pdf | ppt | txt | tar | mid | midi | wav | bmp | rtf | js | mov ) $ (
# Above suffix files directly follow Mongrel nginx does not take a
root / home / abendas / www / www.abendas.com / public;

)

error_page 500 502 503 504 / 50x.html;
location = / 50x.html (
root / var / www / nginx-default;
)
)

I remember after the restart Mongrel and nginx on
sudo / etc / init.d / mongrel start | restart | stop
sudo / etc / init.d / nginx start | restart | stop

nginx settings inside the server (
listen 80; ...
If the meter has, it will not boot to start nginx, at nginx log says can not resolve ip ...
One can imagine, nginx than the name of the boot sequence before the other services rely on ...
sudo update-rc.d nginx remove delete nginx automatically activated
sudo update-rc.d nginx start 99 1 2 3 4 5 6.
# 99 is the sequence, you can look at other start of the sequence, and then put behind nginx put on the list