- 安装thin
- gem install thin
- thin start
- 生成配置文件
- thin config -C myapp.yml -s3 -p 3000
- thin start -C myapp.yml
- 配置nginx.conf文件
- upstream mongrel {
- server 127.0.0.1:3001;
- server 127.0.0.1:3002;
- server 127.0.0.1:3003;
- }
- rver {
- listen 3000;
- client_max_body_size 100M;
- root /var/www/sms/public;
- access_log /var/www/sms/log/nginx.access.log;
- if (-f $document_root/system/maintenance.html) {
- rewrite ^(.*)$ /system/maintenance.html last;
- break;
- }
- location / {
- proxy_set_header X-Real-IP $remote_addr;
- # needed for HTTPS
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $http_host;
- proxy_redirect false;
- proxy_max_temp_file_size 0;
- if (-f $request_filename) {
- break;
- }
- if (-f $request_filename/index.html) {
- rewrite (.*) $1/index.html break;
- }
- if (-f $request_filename.html) {
- rewrite (.*) $1.html break;
- }
- if (!-f $request_filename) {
- proxy_pass http://mongrel;
- break;
- }
- }
- error_page 500 502 503 504 /500.html;
- location = /500.html {
- root /var/www/sms/public;
- }
- 启动thin集群
- thin start -C myapp.yml
nginx thin 部署rails3程序
最新推荐文章于 2025-05-12 10:09:48 发布