关闭

nginx + rails完整版配置文件

标签: nginxruby
146人阅读 评论(0) 收藏 举报
分类:
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}


http {
    passenger_root /usr/local/rvm/gems/ruby-2.2.1/gems/passenger-5.0.22;
    passenger_ruby /usr/local/rvm/gems/ruby-2.2.1/wrappers/ruby;
    include       mime.types;
    default_type  application/octet-stream;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    client_max_body_size 20m;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /alidata1/website/04-xhjdcd.com-production/spark-point-website;
            index  index.html index.htm;
        }

        #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 {
        server_name yuanlunchuan.vicp.net;
        listen      80;
        root        /alidata1/website/01-xhjdcd.com-alpha/spark-point-website;
        passenger_enabled off;

        location / {
            index   index.html;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

    server {
        server_name  www.xhjdcd.com;
        rewrite ^(.*) http://xhjdcd.com$1 permanent;
    }

    #rails项目部署
    server {
        server_name yuanlunchuan.vicp.net;
        listen      80;
        root        /var/rails_project/public;
        passenger_enabled on;
        passenger_app_env production;
        passenger_env_var DATABASE_USERNAME developer;
        passenger_env_var DATABASE_PASSWORD password;
        passenger_env_var DATABASE_NAME     sammartini_alpha;
        passenger_env_var SECRET_KEY_BASE   a05eb3260cf73d139423485c1701cb2c5a4b308732727789985a705e6698aa8af17ce802fe7eeaa241c85952bebebd1dcb3bf8b3974c97ecadf5d3451f6346bf;

        location / {
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:23027次
    • 积分:408
    • 等级:
    • 排名:千里之外
    • 原创:16篇
    • 转载:2篇
    • 译文:1篇
    • 评论:5条
    最新评论