在不同端口上启动瘦服务器 [英] Starting thin server on different ports

查看:52
本文介绍了在不同端口上启动瘦服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是个新手 o 瘦.我有一个 ruby​​ on rails 应用程序.今天可以正常启动应用了,通过命令

I'm a newbie o thin. I have a ruby on rails application. Today I can start the application normally, by the command

sudo thin start -d

我们为测试创建了一个新数据库.(一个是干净的数据库,另一个用于测试,因此可能会被搞砸)在 database.yml 文件上.

We have created a new database for tests. (one is a clean database, and he other is for testing so can be messed up) on the database.yml file.

我想在使用不同数据库的两个不同端口中启动同一个应用程序.

I would like to start the same application in two different ports using the different databases.

要使用数据库启动应用程序,我可以使用 Thin 的 ENV 选项:

To start an application with the database I can use the ENV option of thin:

sudo thin start -d -e production -p 3040

没问题.但是当我尝试启动常规"服务器时,它说 Thins 已经在运行.我怎么能在 ame Thin 命令中启动这两个应用程序.有没有办法为此制作配置文件?

It woks fine. But when I try to start the 'regular' server, it says thins is already running. How could I start both application in the ame thin command. Is there a way to make a configuration file for this?

推荐答案

仅供参考.

我找到了这个问题的解决方案.您可以使用相同的应用程序和相同的环境在不同端口上启动瘦服务器.

I found the solutions for this question. You CAN start the thin server on different ports with tha same application and with the same environment.

您只需要通过 -P (UpperCase) 参数设置不同的 PID 文件.

You just need to set different PID files by the -P (UpperCase) parameter.

示例:

Server 1(3030端口,生产环境,默认pid,脱机)

Server 1 (port 3030, production environment, default pid, deattached)

thin start -e production -p 3030 -d

Server 2(3040端口,生产环境,MY_PID.pid"pid文件,脱附)

Server 2 (port 3040, production environment,"MY_PID.pid" pid file, deattached)

thin start -e production -p 3040 -P MY_PID.pid -d

这篇关于在不同端口上启动瘦服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆