当前位置: 首页> 汽车> 维修 > 使用puma部署ruby on rails的记录

使用puma部署ruby on rails的记录

时间:2025/7/13 20:29:56来源:https://blog.csdn.net/yagas/article/details/140601015 浏览次数: 0次

之前写过一篇《记录一下我的Ruby On Rails的systemd服务脚本》的记录,现在补上一个比较政治正确的Ruby On Rails的生产环境部署记录。使用Puma部署项目。

创建文件 /usr/lib/systemd/system/puma.service

[Unit]
Description=Puma HTTP Server
Documentation=Ruby On Rails
After=network.target[Service]
Type=notify
WorkingDirectory=/your_application_path
ExecStart=/usr/local/bin/puma -C /your_application_path/config/puma.rb
TimeoutStopSec=5
KillMode=mixed
Restart=always[Install]
WantedBy=multi-user.target

设置为随系统自动启动

systemctl enable puma.service
systemctl start puma.service

当启动浏览器启动时,你可能会收到如下的提醒
在这里插入图片描述
说明当前的域名不支持被请求。编辑/you_application_path/config/environments/development.rb,在倒数第一行,end这一行的上面,添加域名配置

config.hosts << "the24.wang"
config.hosts << "www.the24.wang"

重新启动服务

systemctl restart puma.service

到些,完成整个项目的配置工作。

关键字:使用puma部署ruby on rails的记录

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: