l-migrate2cloud-1-pd..
l-migrate2cloud-1-pd..
l-migrate2cloud-1-pd..
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
developerWorks®<br />
ibm.com/developerWorks<br />
and is good at proxying connections to a back-end service like mongrel. Listing 10<br />
shows how to install nginx.<br />
Listing 10. Installing nginx<br />
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm<br />
...<br />
# yum install nginx<br />
...<br />
Running Transaction<br />
Installing : nginx [1/1]<br />
Installed: nginx.i386 0:0.6.39-4.el5<br />
Complete!<br />
# chkconfig nginx on<br />
Listing 11 installs the Extra Packages for Enterprise Linux® (EPEL) repository, then<br />
installs nginx and makes sure it will come up on startup.<br />
Listing 11. An nginx configuration for a rails application<br />
# Two mongrels, balanced based on least connections<br />
upstream mongrel-payroll {<br />
fair;<br />
server 127.0.0.1:8100;<br />
server 127.0.0.1:8101;<br />
}<br />
server {<br />
listen 80;<br />
server_name<br />
app.smallpayroll.ca;<br />
root /home/payroll/current/public;<br />
gzip_static on;<br />
access_log /var/log/nginx/app.smallpayroll.ca_log main;<br />
error_page 404 /404.html;<br />
location / {<br />
# Because we're proxying, set some environment variables indicating this<br />
proxy_set_header X-Real-IP $remote_addr;<br />
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br />
proxy_set_header Host $http_host;<br />
proxy_redirect false;<br />
proxy_max_temp_file_size 0;<br />
# Serve static files out of Root (eg public)<br />
if (-f $request_filename) {<br />
break;<br />
}<br />
# Handle page cached actions by looking for the appropriately named file<br />
if (-f $request_filename.html) {<br />
rewrite (.*) $1.html;<br />
break;<br />
}<br />
# Send all other requests to mongrel<br />
if (!-f $request_filename) {<br />
proxy_pass http://mongrel-payroll;<br />
break;<br />
Initial migration<br />
Trademarks<br />
© Copyright IBM Corporation 2010. All rights reserved. Page 14 of 21