Tag: nginx

Rails部署Digitalocean ActiveSupport :: MessageEncryptor :: InvalidMessage:

我正在按照本指南在digitalocean上部署应用程序: https : //www.digitalocean.com/community/tutorials/deploying-a-rails-app-on-ubuntu-14-04-with-capistrano-nginx-and-彪马#先决条件 当我使用cap cap production deploy:initial –trace我一直收到此错误 部署在此处停止: 01 ~/.rvm/bin/rvm default do bundle exec rake assets:precompile 01 rake aborted! 01 01 ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::Inva… 01 01 ~/.rvm/bin/rvm default do bundle exec rake assets:precompile 01 rake aborted! 01 01 ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::Inva… 01 当我运行bundle exec rake资产时:在本地预编译我得到yarn install v1.7.0 [1/4] 🔍 Resolving packages… success Already up-to-date. ✨ […]

rails 500错误没有生产日志条目

我在与另一个应用程序相同的服务器上安装了新的rails应用程序。 原版运行正常,但新的应用程序给了我臭名昭着的“我们很抱歉,但出了点问题”,但生产日志中没有条目。 生产日志中的最后一个条目来自我使用rake的迁移。 我发现如果我运行cap deploy:冷却它会工作但是接下来的yupdate将再次失败而没有sock文件。 然后是cap deploy:每次更新时都需要冷。 编辑:如果我运行/etc/init.d/unicorn_taxidata restart我得到“无法重新加载”然后如果我再次运行它立即开始正常。 该应用程序正在开发中。 环境是NGINX,独角兽,postgresql,rails 4.0.0.0,ruby 2.0.0p195。 我的nginx错误日志中有这个错误: [crit] 889#0: *65 connect() to unix:/tmp/unicorn.myapp.sock failed (2: No such file or directory) while connecting to upstream, client: 1.123.13.26, server: myapp.com.au, request: “GET /login HTTP/1.1”, upstream: “http://unix:/tmp/unicorn.myapp.sock:/login”

Nginx工作进程无法访问config.ru

我在DO Ubuntu x64上设置了我的RoR应用程序。 在Nginx port 8080 。 我的配置: server { listen 8080; # server_name www.mydomain.com; passenger_enabled on; passenger_app_env development; root /home/edgars/Proj/public; } 在Nginx日志文件中出错: Cannot stat ‘/home/edgars/Proj/config.ru; This error means that the Nginx worker process (PID 18065, running as UID 33) does not have permission to access this file. 正如我对此问题的研究表明,我需要确保Nginx用户可以访问该路径。 sudo -u www-data cd /edgars 得到错误: […]

对于机架应用程序,如何使乘客独立服务于.erb文件的输出而不是发送.erb文件本身?

我有一个简单的config.ru机架应用程序 ,我只需要并运行机架服务器页面,以快速方便的方式提供动态页面。 这个config.ru应用程序由phusion passenger-standalone (内部使用nginx)提供服务。 正确处理和提供.erb文件,除非我明确地将.erb扩展名添加到URL(对于.erb文件)。 在这种情况下,服务器将向我发送.erb文件以供下载,而不是其输出。 显然我想避免这种情况。 为了更清楚: 服务器上的文件名为somefile.erb 这工作: www.domain.com/somefile 这会发送.erb文件供下载 ☹: www.domain.com/somefile.erb 我怎样才能解决这个问题? 这是我应该在应用程序级别 (机架式服务器页面) 或Web服务器级别 (nginx配置)管理的问题吗? 在这两种情况下我都需要一些帮助…… 更新2:我认为这个机架式服务器页面文件可能是相关的 …但它只是一个疯狂的猜测,我不知道该改变什么.. 更新1:粘贴乘客独立的Nginx配置文件。 Passenger-standalone内部使用Nginx,但设置与/etc/nginx/nginx.conf的系统范围Nginx /etc/nginx/nginx.conf 。 根据/usr/share/passenger/templates/standalone/config.erb的文件,在每个乘客独立运行时重新生成乘客独立Nginx的默认设置。 以下是该文件: ############################################################## # Phusion Passenger Standalone uses a template file to # generate an Nginx configuration file. The original template # file can be found by running […]

NGINX上的多个Rails应用程序(反向代理)

我的服务器上有两个rails应用程序。 它们中的每一个都在瘦服务器上运行。 我也在使用NGINX。 这是我的NGINX配置文件: server{ location /blog { proxy_pass http://127.0.0.1:8082; proxy_set_header Host $host; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection “upgrade”; } location /website1 { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection “upgrade”; } } “ http:// HOST / blog ”=>我收到404错误(空白页) “ http:// [HOST] / website1 ”=>我的Rails应用程序出现404错误,在我的应用程序日志中得到: INFO — : […]

Rails聊天应用程序的FAYE_URL值应该是多少?

我正在尝试使用“private_pub”gem创建基于Rails的聊天Web应用程序,它在我的localhost服务器上运行良好。 现在我的网站托管在DigitalOcean上,我想在服务器上推送聊天代码,看看实时聊天应用程序将如何运作。 这是我的private_pub.yml文件 development: server: “http://localhost:9292/faye” secret_token: “secret” test: server: “http://localhost:9292/faye” secret_token: “secret” staging: server: secret_token:”secret_key” signature_expiration: 3600 # one hour production: server: secret_token: “secret_key” signature_expiration: 3600 # one hour 我的问题是我应该怎样做才能使它在任何Linux服务器上运行(这里是Digital Ocean)。 我在DigitalOcean上使用Nginx服务器。 private_pub.yml文件中FAYE_URL的值应该是多少? rackup private_pub.ru -s thin -E production 我必须在服务器终端上运行机架命令吗? 或者还有其他方法可以在不同的服务器上托管Faye吗?

无法让nginx在生产中使用Rails应用程序

我有一个Rails应用程序,它在Webrick的本地机器上运行良好。 我尝试将其部署到AWS EC2。 我已将我的应用程序源从bitbucket复制到/home/ubuntu并通过此命令安装了nginx和passenger(以及其他所需的所有内容,如gem,ruby等): rvmsudo passenger-install-nginx-module 然后我这样做了: $ git clone git://github.com/jnstq/rails-nginx-passenger-ubuntu.git $ sudo mv rails-nginx-passenger-ubuntu/nginx/nginx /etc/init.d/nginx $ sudo chown root:root /etc/init.d/nginx Nginx本身运行良好(!),例如: $ sudo /etc/init.d/nginx restart * Stopping Nginx Server… [ OK ] * Starting Nginx Server… [ OK ] 它安装在/ opt / nginx中,即使这样我也必须使用/etc/init.d/nginx来控制它的状态。 这是我的/opt/nginx/nginx.conf文件: server { listen 80; server_name localhost; root /home/ubuntu/my_app/public/; passenger_enabled on; […]

如何使用Rails应用程序保存SSL证书并在NGINX中创建虚拟主机?

我有一个Rails应用程序,它使用gem Rails Let’s Encrypt为自定义域生成SSL证书。 gem非常简单易用。 安装/配置后,我可以生成证书,数据将存储在数据库中。 我想将certificate CRT和certificate KEY保存在相应的NGINX文件夹中: /etc/nginx/ssl/ 在那之后,我想: 复制文件/etc/nginx/sites-available/default并使用名称/etc/nginx/sites-available/customdomain.com保存 使用以下命令更改文件customdomain.com : 内容: server { listen 80; listen 443 ssl; server_name www.customdomain.com; ssl_certificate /etc/nginx/ssl/customdomain.crt; ssl_certificate_key /etc/nginx/ssl/customdomain.key; passenger_enabled on; root /home/ubuntu/myapp/current/public; gzip on; gzip_http_version 1.1; gzip_vary on; gzip_comp_level 6; gzip_proxied any; gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript gzip_disable “msie6”; location ^~ /assets/ { […]

服务器Ruby on Rails + unicorn + nginx停止响应

我的服务器Rails工作正常,但在没有请求的10分钟后,它的响应是一个糟糕的网关。 我真的认为我的配置是有序的,但它不起作用。 我没有更多的想法发生了什么。 我的配置: unicorn.rb: @dir = File.expand_path(File.dirname(__FILE__)) + “/..” worker_processes 2 working_directory @dir timeout 10 listen File.join(‘/tmp/nutrimais.sock’) listen File.join(‘/tmp/nutrimais_2.sock’) preload_app true# if ENV[‘RAILS_ENV’] != ‘development’ GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true check_client_connection false before_fork do |server, worker| Signal.trap ‘TERM’ do puts ‘Unicorn master intercepting TERM and sending myself QUIT instead’ Process.kill ‘QUIT’, Process.pid end defined?(ActiveRecord::Base) […]