不灭的焱

革命尚未成功,同志仍须努力下载JDK17

作者:Albert.Wen  添加时间:2023-02-15 23:51:21  修改时间:2024-04-28 16:47:01  分类:Golang/Ruby  编辑

Rubyinstaller


  1. CentOS 7 下编译安装 Ruby 并通过 Gem 安装软件包
  2. 配置 RubyGems为 Ruby中国镜像
  3. CentOS 7 安装metasploit,报错An error occurred while installing pg (1.4.3), and Bundler cannot continue.
  4. rails5.2.2框架路由的定义使用
  5. CentOS 安装配置 GitLab

一、如何更改Rails 4.2开发服务器的默认绑定IP?

默认只绑定了IP 127.0.0.1,这就意味着只能本地访问,其他人访问不了。

在配置config/puma.rb文件中,添加如下内容:

set_default_host '0.0.0.0' # Note: Must come BEFORE defining the port

port ENV.fetch('PORT') { 3000 }

二、启动、停止 脚本

# 启动

rails server -d

# 停止

ps -ef | grep  puma
kill -9 进程号

 

如何在后台启动ruby/rail服务器?

只需添加标签-d即可将其作为守护进程启动...

bundle exec ruby bin/rails server -d -b 192.168.0.8  -p 3000 webrick -e production