【linux – 如何设置Ruby GEM_HOME和GEM_PATH】教程文章相关的互联网学习教程文章

ruby-如何使用rake检查Linux上是否安装了特定软件包?

在尝试使用ubuntu上的rake自动执行某些任务时,遇到了目标计算机上可能尚未存在要求打包的情况.检查系统中是否已安装某些软件包并做出相应响应的好方法是什么? 例如,我想在某些任务中运行“ npm start”,但是我想知道系统上是否已经安装了npm,从而为用户提供了正确的错误消息.如果可能的话,我也很好.解决方法:您可以使用Kernel.system方法从Ruby脚本运行系统命令.考虑如下内容: 除非系统失败(“哪npm”)

ruby-on-rails-如何配置Nginx代理到Rails应用程序?这样我就不必说domain.com:port【代码】

更新:目前,我在domain.com:3000上访问我的应用程序,但是我想访问domain.com来查看我的应用程序我在80处设置了nginx以在3000处代理我的rails应用程序.以下是配置upstream railsapp {server 127.0.0.1:3000; }server {listen 80;server_name APP;# Tell Nginx and Passenger where your app's 'public' directory isroot /var/www/APP/current/public;index index.html index.htm;# Static assets are served from the mentioned ro...

ruby-on-rails-使用Nginx和Puma在Ruby on Rails应用程序上启用SSL【代码】

这是我的Nginx conf文件:upstream app {server unix:/home/deploy/example_app/shared/tmp/sockets/puma.sock fail_timeout=0; }server {listen 80;listen 443 ssl;# ssl on;server_name localhost example.com www.example.com;root /home/deploy/example_app/current/public;ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;try_...

ruby-on-rails-Nginx工作进程无法访问config.ru【代码】

我已经在DO Ubuntu x64上设置了RoR应用程序.在Nginx端口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.正如...

ruby-on-rails-Nginx将上游头传递给远程请求【代码】

这个问题类似于this one,但是在aws s3资源上执行x-accel-redirect.前者试图将上游头设置为本地请求.这很好.但是现在我已将内容移至亚马逊s3,并且我想对s3对象实施相同的受限下载. 这是我的nginx配置proxy_pass_header X-Accel-Redirect; passenger_pass_header X-Accel-Redirect;location ~* ^/download_zip/(.*) {internal;resolver 8.8.8.8 valid=300s;proxy_buffering off;proxy_set_header Content-Length ""; proxy_set_heade...

ruby-on-rails-为什么我们需要在生产设置上使用薄的Nginx?

为什么我们需要在生产设置中安装带有Thin的nginx,因为Thin本身就是Web服务器.人们每篇博文都使用Nginx稀薄吗?解决方法:正如Michael nginx所说的那样,天平很薄(无论什么意思).但是在任何ruby服务器之前使用nginx的另一个原因是要提供静态文件(如果您使用页面缓存,nginx也可以提供它们),这意味着请求甚至不会碰到ruby应用程序,从而大大提高了性能.还有nginx,尽管它似乎是ruby/轨道社区中的流行选择,但还有其他替代方法,例如apache.

ruby-on-rails-如何将ImageMagick环境变量传递给nginx mongrels?【代码】

我的Rails应用程序使用ImageMagick,但是该应用程序在尝试执行ImageMagick命令(“ identify”)时失败.我通过在Apache配置中传递以下环境变量来解决开发中的问题(正在运行Apache / Passenger):SetEnv MAGICK_HOME /opt/local/var/macports/software/ImageMagick/6.5.9-0_0+q16SetEnv DYLD_LIBRARY_PATH /opt/local/var/macports/software/ImageMagick/6.5.9-0_0+q16/opt/local/libSetEnv PATH /usr/bin:/opt/local/var/macports/sof...

ruby-on-rails-Rails-Elastick Beanstalk nginx / error.log【代码】

尝试将我的Rails应用程序上传到弹性beantalk.我已经成功部署了我的应用程序并创建了postgres数据库.我的应用程序可在开发服务器上的sqlite3上运行. 我的eb状态已准备就绪,健康状况良好. 我的eb日志文件;/var/log/nginx/error.log ------------------------------------- 2016/05/27 11:15:44 [warn] 2797#0: conflicting server name "localhost" on 0.0.0.0:80, ignored 2016/05/27 11:27:26 [crit] 2805#0: *140 connect() to u...

ruby-on-rails – net :: ERR_INCOMPLETE_CHUNKED_ENCODING nginx【代码】

我在2个不同的服务器上托管了2个RoR Web应用程序.对于一个特定页面,请求从第二个应用程序提供.对于其余页面,请求由主应用程序提供.主应用程序的Nginx设置location /customer/help/ {proxy_pass http://second-application:3020/help_and_support/; } location /assets/ {proxy_pass http://second-application:3020/assets/; }这工作到昨天一直很好.现在,/ customer / help / page未正确加载.在Firefox中它显示一个空白页面,在chro...

ruby-on-rails – 生产中带有自定义(非80)端口的Rails’* _url助手. (Nginx,独角兽)【代码】

我是铁轨生产环境中的菜鸟.我可以配置nginx和unicorn来响应其他(非80)端口吗?我不需要任何域名,我只需要ip和端口.这是我的应用程序的nginx配置(80端口):server {listen 80;server_name localhost;root /home/my_app_folder/web-app/public;client_max_body_size 32m;location / {try_files $uri @unicorn;}location @unicorn {proxy_set_header Client-Ip $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwa...

ruby-on-rails – Access-Control-Allow-Origin无法使用Backbone json请求,Nginx设置“全开”,标题看起来很好【代码】

您好我需要从Backbone向API发出json请求(我可以控制服务器端)..虽然响应头看起来很好,但我一直得到Access-Control-Allow-Origin. 以下是Nginx设置:location / {if ($request_method = 'OPTIONS') {add_header 'Access-Control-Allow-Origin' '*';add_header 'Access-Control-Allow-Credentials' 'true';add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-Req...

ruby-on-rails – rvmsudo passenger-install-nginx-module:没有这样的文件或目录【代码】

我正在尝试将passenger / nginx安装到ubuntu 12.10上. 当我尝试运行rvmsudo passenger-install-nginx-module时,我得到:/usr/bin/env: passenger-install-nginx-module: No such file or directory$PATH结果bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/local/games:/home/deploy/.rvm/bin:/home/deploy/.rvm/bin: No such file or directoryRVM信息:ruby-2.0.0-p247:system:uname: ...

ruby – 如何从Ansible安装passenger-nginx?【代码】

我正在尝试使用Ansible 1.4.1在Ubuntu 12.04上使用nginx运行乘客Web服务器的安装.似乎gem安装正在搞乱或者其他什么,因为ansible找不到命令,当我重新安装时宝石手工制作.我究竟做错了什么?# ruby.yml- name: "install ruby"script: scripts/install_ruby.sh- name: "Install bundler"gem: name=bundler state=latest- name: "Install passenger"gem: name=passenger state=latest- name: "Copy nginx upstart"copy: src=nginx.conf...

ruby-on-rails – 坏URI(不是URI?)在ubuntu终端中运行rails时【代码】

我一直试图在我的一个项目上运行rails.我是RoR的完全初学者,只是试图通过首先尝试运行文件并查看网站的外观来开始.但是,似乎我陷入了这个问题,我无法真正找到解决方案.谁能帮我? 这是错误:/home/peh/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/uri/common.rb:176:in `split': bad URI(is not URI?): (URI::InvalidURIError) from /home/peh/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/uri/common.rb:211:in `parse' from /h...

ruby-on-rails – nginx:从命名位置的proxy_pass中删除路径【代码】

我有这个nginx配置来提供rails应用程序:location ^~ /api/ {alias /srv/www/rails/public/;try_files $uri @unicorn;}location @unicorn {proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto $scheme;proxy_set_header Host $http_host;proxy_redirect off;proxy_pass http://127.0.0.1:2007;}我想从路径的开头删除/ api /,然后将其传递给rails app,但由于它是一个命名位置,我不能...

RUBY - 相关标签