centos6下ruby环境部署--详细--self

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


-----------------------------------------------------------------------centos6.2下ruby环境部署----------------------------------------------------------------------
一:安装环境依赖包(gcc -v:检查是否存在gcc环境,若没有执行以下安装;若有,最好执行)
     yum -y install gcc

     yum install flex autoconf zlib curl zlib-devel curl-devel bzip2 bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel gcc+ gcc-c++ libxml2 libxml2-devel libxslt libxslt-devel

二:安装rvm     sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

三:安装ruby    rvm install 1.9.2(安装ruby)   rvm use ruby-1.9.2 --default(将ruby设置为默认环境)

四:安装rails   gem install rails -v 3.0.0 

五:安装mysql   yum install mysql*

--------------------------------------------------------------------------至此,环境部署完毕--------------------------------------------------------------------------






----------------------------------------------------------------------------服务器配置安装-------------------------------------------------------------------------------
一: 安装应用服务器          gem install passenger
二: 安装web服务器(nginx)   passenger-install-nginx-module(期间一路回车即可,【pcre最好安装,不装也可】) 
三: 配置nginx.conf
server {
        listen       80;
        server_name  localhost;
        root /xxx/public;   # <--- be sure to point to 'public'!定位项目的public目录 
        passenger_enabled on;
        rails_env development;
        charset utf-8;

        #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;
        #}
    } 
四: 服务启动:命令执行nginx目录中sbin下的nginx 例如:我的安装目录是/opt/nginx 则执行/opt/nginx/sbin/nginx即可




-----------------------------------------------------------------------------注意事项-------------------------------------------------------------------------------
一: LoadError (no such file to load — openssl)
    解决方法:rvm remove ruby【-版本】 或者yum remove ruby  --卸载ruby,重装即可

你可能感兴趣的:(Rails,环境部署)