我试图与Facebook的实时更新工作,但我有困难给Facebook一个callback地址,他们可以使用。 我的开发机器在防火墙后面,所以我想使用ec2实例将stream量转发到开发机器。 目前进展情况: 应用程序已启动并在本地主机上运行: http://0.0.0.0:5000 在ec2上创build了Ubuntu 10.11实例 授权ec2实例上的端口 localhost$ec2-authorize default -p 5000 localhost$ec2-authorize default -p 22 在ec2上configurationsshd localhost$ssh -i ubuntu@ec2_public_dns -i ~/.ssh/ec2_key_pair.pem ec2$sudo echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config ec2$sudo echo "GatewayPorts yes" >> /etc/ssh/sshd_config ec2$sudo /ect/init.d/ssh restart 启动SSH隧道 localhost$ssh -R0.0.0.0:5000:localhost:5000 ubuntu@ec2_public_dns -i ~/.ssh/ec2_key_pair.pem 在浏览器中testing它 http://ec2_public_dns:5000 但没有任何反应:(请求只是超时。任何想法我做错了什么? 谢谢! 进展 好的,我在本地机器上的Web服务器上取得了一些进展。 在我ssh之后,我可以使用curl从提示符中获取主页: localhost$ssh -R0.0.0.0:5000:localhost:5000 ubuntu@ec2_public_dns -i ~/.ssh/ec2_key_pair.pem […]
我正在尝试使用nginx来提供静态caching文件。 在rails_root/public/cache目录下有index.html文件。 我首先尝试了下面的configuration,这不起作用: root <%= current_path %>/public; try_files /cache$uri/index.html /cache$uri.html @rails; 这给错误: [error] 4056#0: *13503414 directory index of "(…)current/public/" is forbidden, request: "GET / HTTP/1.1" 我然后尝试 root <%= current_path %>/public/cache; try_files $uri/index.html $uri.html @rails; 而令我惊讶的是这个作品。 为什么我可以做后者而不是前者(因为他们指向同一地点) 文件系统的权限 这些文件夹的权限是: 775 public 755 cache 644 index.html Rails坐在用户目录下,所以文件夹和文件都属于用户good 。 nginx的用户对于每个工作处理器来说是master和http root : 89:http 7865 0.1 0.0 8876 2624 […]
我似乎无法让我的服务器加载环境variables。 在我理想的设置中,我希望1个用户(部署者)在单个服务器上提供多个应用程序。 Ubuntu 12.04,Nginx,Unicorn。 在我的应用程序中,我有一个包含应用程序所需的所有环境variables的.env文件。 这是我失败的尝试: 我用特殊的shell脚本启动独angular兽。 我不能在这里使用源代码,所以我不知道如何加载其中的环境variables。 #!/bin/sh ### BEGIN INIT INFO # Provides: unicorn # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Manage unicorn server # Description: Start, stop, restart unicorn server for a specific application. ### END INIT INFO […]
我在RHEL上运行Phusion Passenger,托pipe一个Rails应用程序。 我可以在Apache启动时使用PassengerPreStart设置成功启动一个乘客实例,但只有当我使用apachectl start启动Apache apachectl start 。 如果我使用service httpd start的RHEL约定启动Apache,则不会执行PassengerPreStart 。 也就是说,没有乘客实例在Apache启动时加载。 我比较了两个脚本( apachectl和service httpd脚本)的差异,但找不到任何不同的行为之间的差异。 我可以编写一个init脚本来使用apachectl来启动Apache,但是首先我想问一下,如果有人看到apachectl和service http如何与Apache模块交互,特别是使用Passenger的PassengerPreStart设置并解释它的话。
我正在Apache / Passenger下的服务器上运行一组rails应用程序。 其中一个应用程序不断进入状态,机器的负载变得非常高,机器变得没有响应,顶部显示大部分CPU时间花在IO等待上,但没有一个进程花费太多时间。 iowait和ifwait没有显示任何exception。 乘客状态是最有趣的,它显示了我怀疑是应用程序(下面的输出中的应用程序x)的每个应用程序进程被占用1个会话。 我可以杀死所有这些进程和乘客replace它们对服务器负载没有影响,只有当我重新启动Apache或服务器加载恢复正常。 这是输出: ———– General information ———– max = 20 count = 20 active = 16 inactive = 4 Waiting on global queue: 22 ———– Application groups ———– /home/A: App root: /home/A * PID: 5379 Sessions: 0 Processed: 6 Uptime: 3m 42s /home/X: App root: /home/X * PID: 5604 Sessions: […]
在Rails应用程序中redirect用户之后,由于某种原因,缺less域之后的斜杠。 生成的url无效,我不得不手动更正它们。 该问题只发生在一个子域上。 在不同的主域(相同的服务器)上,一切正常。 例如,注销后,该网站正在转到https://www.sub.domain.comlogin/,而不是https://www.sub.domain.com/login 我怀疑这个问题与虚拟主机设置有关,但我不确定。 这里是破碎和工作的鬼魂: 损坏的子域 <VirtualHost *:80> ServerName www.sub.domain.com ServerAlias sub.domain.com Redirect permanent / https://www.sub.domain.com </VirtualHost> <VirtualHost *:443> ServerAdmin [email protected] ServerName www.sub.domain.com ServerAlias sub.domain.com RailsEnv production # SSL Engine Switch SSLEngine on # SSL Cipher Suite: SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL # Server Certificate SSLCertificateFile /path/to/server.crt # Server Private Key SSLCertificateKeyFile /path/to/server.key # Set header […]
我已经build立并运行了一个RAILS应用程序(graylog2),下面的configuration使它适用于根目录: server { server_name www.mydomain.com; location / { gzip off; uwsgi_modifier1 7; include uwsgi_params; uwsgi_pass 127.0.0.1:3033; } } 但我想把我的应用程序放在一个path,例如: /graylog2 我改变了我的configuration,添加了uwsgi_param SCRIPT_NAME /graylog2但没有奏效。 server { server_name www.mydomain.com; root /opt/graylog2-web-interface/public/; location /graylog2 { gzip off; include uwsgi_params; uwsgi_param SCRIPT_NAME /graylog2; uwsgi_modifier1 7; uwsgi_pass graylog2; } location / { autoindex on; } } 我使用Ubuntu 12.04.1 LTS,nginx / […]
我有Rails应用程序运行在独angular兽+ nginx上。 下面是nginx.conf和unicorn.rbconfiguration。 nginx.conf upstream unicorn { server unix:/tmp/unicorn.todo.sock fail_timeout=0; } server{ listen 80 default deferred; #server_name localhost; root /var/www/demo/public; try_files $uri/index.html $uri @unicorn; location @unicorn { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://unicorn; } error_page 500 502 503 504 /500.html; client_max_body_size 4G; keepalive_timeout 10; } unicorn.rb working_directory "/var/www/demo" pid "/var/www/demo/tmp/pids/unicorn.pid" stderr_path […]
我正在使用美洲狮和nxinx,并据我所知,它只是使用一个单一的线程,即使我用16个或更多的默认线程启动它。 我已经build立了一个新的rails应用程序,然后通过这里描述的设置: http://blog.wiemann.name/rails-server 这给了这个例子nginxconfiguration: upstream benchmarkapp.com {server unix:/tmp/benchmark_app.sock fail_timeout=0;} server { server_name benchmarkapp.com; root /home/tristan/benchmark_app/public; try_files $uri/index.html $uri @benchmarkapp.com; location @benchmarkapp.com { proxy_redirect off; proxy_pass http://benchmarkapp.com; } } 然后创build一个简单的控制器动作,只是睡3秒,然后呈现“你好”: class WelcomeController < ApplicationController def index sleep(2) render :text => "hello" end end 然后我开始使用puma: puma -t 16 -b unix:///tmp/benchmark_app.sock -S /tmp/benchmark_app.state 一旦运行,我用10个并发用户使用围攻打了它,结果如下 % siege -c 10 […]
我从127.6.205.1开始每2秒钟收到一个奇怪的请求。 我的production.log(Ruby on Rails)文件如下所示: > … 我,[2015-01-16T15:05:23.491062#79682]信息 – :开始GET“/”为127.6.205.1在2015-01-16 15:05:23 -0500 我,[2015-01-16T15:05:23.493081#79682]信息 – :通过HomeController#index处理为HTML 我,[2015-01-16T15:05:23.499908#79682]信息 – :渲染布局/应用程序中的home / index.haml(5.2ms) 我,[2015-01-16T15:05:23.500405#79682]信息 – :在7ms内完成200 OK(查看:6.2ms | ActiveRecord:0.0ms) 我,[2015-01-16T15:05:25.508127#79682]信息 – :开始GET“/”为127.6.205.1于2015-01-16 15:05:25 -0500 我,[2015-01-16T15:05:25.510744#79682] INFO – :通过HomeController#index处理为HTML 我,[2015-01-16T15:05:25.518685#79682]信息 – :渲染布局/应用程序中的home / index.haml(6.2ms) 我,[2015-01-16T15:05:25.519226#79682]信息 – :在8ms内完成200 OK(查看:7.2ms | ActiveRecord:0.0ms) 我,[2015-01-16T15:05:27.524949#79682]信息 – :开始获取“/”为127.6.205.1于2015-01-16 15:05:27 -0500 我,[2015-01-16T15:05:27.527011#79682] INFO – :通过HomeController#index处理为HTML 我,[2015-01-16T15:05:27.532497#79682]信息 […]