自学内容网 自学内容网

使用puma部署ruby on rails的记录

之前写过一篇《记录一下我的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

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


原文地址:https://blog.csdn.net/yagas/article/details/140601015

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!