我在本地运行Rails应用程序(瘦服务器),我可以从浏览器本地连接(localhost:3000),但是当我尝试使用curl时,我得到:
curl -H 'id:1' -i 'http://localhost:3000/api/data' -v
* Hostname was NOT found in DNS cache
* Trying ::1...
* Adding handle: conn: 0x7fd121808200
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fd121808200) send_pipe: 1, recv_pipe: 0
* Connection failed
* connect to ::1 port 3000 failed: Connection refused
* Trying fe80::1...
* Connection failed
* connect to fe80::1 port 3000 failed: Connection refused
* Failed to connect to localhost port …Run Code Online (Sandbox Code Playgroud) 所以我试图通过RVM作为服务运行.后一个thin install我手动更新/etc/init.d/thin使用一个su - user运行的配置命令时,使薄正在运行作为本地用户,而不是根.到现在为止还挺好.
现在,当我尝试sudo service thin start它时,它似乎正在尝试使用非RVM版本的Ruby(安装在盒子上的1.8.7开始)来实际执行命令.我gem install thin在非RVM版本上做了一个,然后给我一个uninitialized constant Bundler消息 - Bundler只安装在RVM宝石中,而不是系统宝石.看起来我无法设置RVM环境(即使我的RVM启动脚本在〜/ .bashrc中,然后包含在〜/ .bash_profile中).
我想要做的就是使用RVM环境而不是系统环境作为服务运行.这甚至可能吗?我应该放弃并承诺以root身份运行一切的最终罪行吗?这一点非常诱人.
谢谢你的帮助!
我已经将我们的堆栈转换为Rails 4(是的!)
我希望利用线程安全的代码.
美洲狮起床,停止它似乎是一个不同的问题:(
Puma是唯一的多线程导轨吗?
Thin -> EventMachine
Unicorn -> Forking
Puma -> multi-threaded
Mongrel -> don't care
Webbrick -> don't care
Run Code Online (Sandbox Code Playgroud) 我正在学习瘦服务器,现在我可以thin start用来启动服务器,但端口是3000,我应该在浏览器中输入localhost:3000来获取网页.
我想像其他网站一样取消3000端口.所以我设置使用命令thin -p 80 start来使用默认的http端口.但我得到了这个错误:
root@makserver:~/apps/videosite# thin --port 80 start
>> Using rack adapter
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:80, CTRL+C to stop
/usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_tcp_server': no acceptor (RuntimeError)
from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_server'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/backends/tcp_server.rb:16:in `connect'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/backends/base.rb:49:in `block in start'
from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!' …Run Code Online (Sandbox Code Playgroud) 我很震惊,这个问题还没有被提出,但我发誓我到处都是.在开发模式下运行Rails 3时,是否有优于独角兽的优势,反之亦然?
描述错误
我试图做一个gem install puma和gem install thin并得到一个错误。
我有一台全新的 Mac 正在设置:MacOS Catalina 10.15.6 (19G73)
我已经发现任何版本 <= 4.2.1 在我的计算机上都可以正常工作我正在使用asdf版本管理器
gem install puma -v '4.2.1'gem install puma -v '4.3.0'或gem install pumad彪马的错误
我已经尝试了这些命令中的每一个来让它工作
gem install puma
gem install puma -v '4.3.0' -- --with-ldflags=-L/usr/local/opt/openssl@1.1/lib --with-cppflags=-I/usr/local/opt/openssl@1.1/include
gem install puma -v '4.3.0' -- --with-ldflags=-L/usr/local/opt/openssl@1.1/lib --with-cppflags=-I/usr/local/opt/openssl@1.1/include --with-opt-dir=/usr/local/opt/openssl@1.1
Run Code Online (Sandbox Code Playgroud)
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension. …Run Code Online (Sandbox Code Playgroud) 我有一个在nginx中运行的Sinatra应用程序(使用thin作为后代理),我redirect '/<path>'在Sinatra中使用语句.但是,当我在https下访问该站点时,这些重定向将发送给我http://localhost/<path>而不是https://localhost/<path>他们应该这样做.
目前,nginx的将控制传递到薄用这个命令,其中是proxy_pass http://thin_clusterthin_cluster
upstream thin_cluster { server unix:/tmp/thin.cct.0.sock; }
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我尝试安装瘦 Web 服务器 1.7.2 版,但出现错误
与日志:
thin.c:359:10: error: implicit declaration of function 'thin_http_parser_has_error' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
return thin_http_parser_has_error(http) ? Qtrue : Qfalse;
^
thin.c:374:10: error: implicit declaration of function 'thin_http_parser_is_finished' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
return thin_http_parser_is_finished(http) ? Qtrue : Qfalse;
^
9 errors generated.
make: *** [thin.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/Users/dorianmarie/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/thin-1.7.2 for inspection.
Results logged to
/Users/dorianmarie/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/thin-1.7.2/gem_make.out
An error occurred while installing thin (1.7.2), and Bundler cannot …Run Code Online (Sandbox Code Playgroud) 我的rails应用程序在瘦服务器上运行,我想使用apachebench进行基准测试
我使用的命令是
ab -n 1 -c 1 http://localhost:3001/welcome/search?query="doctor"&rad=5
Run Code Online (Sandbox Code Playgroud)
但瘦服务器没有采取这个url.Its给
!! Invalid Request
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我如何给url这样瘦,用查询字符串接受url