nginx+passenger部署ror

本文为firedragonpzy原创,转载务必在明显处注明:
转载自【Softeware MyZone】原文链接: http://www.firedragonpzy.com.cn/index.php/archives/449


配置参数: http://blog.lizhigang.net/archives/137
./configure --prefix=/usr/local/nginx --with-http_ssl_module  --with-pcre=/usr/local/soft/pcre-8.30 --with-openssl=/usr/local /soft/openssl-1.0.1 --add-module=/usr/soft/passenger-3.0.11
1.安装passenger:
gem install passenger

2.安装nginx
passenger-install-nginx-module#(期间一路回车即可,【pcre最好安装,不装也可】)
#----ps -ef | grep nginx | wc -l 查看nginx并发进程数 

3.配置nginx:
server {
        listen       80;
        server_name  localhost;
        root /ror/public;   # <--- be sure to point to 'public'!     
        passenger_enabled on;
        rails_env development;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

    

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
}
server {
        listen       3080;
        server_name  localhost;
        root /var/www/abc/public;   # <--- be sure to point to 'public'!     
        passenger_enabled on;
        charset utf-8;
        sendfile on;
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
   upstream backserver{
      server 127.0.0.1:3080;
    }
    server {
        listen       80;
        server_name  localhost;
        root /var/www/abc/public;   # <--- be sure to point to 'public'!     
        passenger_enabled on;
        charset utf-8;
        sendfile on;
        #access_log  logs/host.access.log  main;

    

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    

你可能感兴趣的:(rails部署)