【问题标题】:What is the best way to run a staging site on my production server?在我的生产服务器上运行临时站点的最佳方式是什么?
【发布时间】:2013-06-21 14:09:34
【问题描述】:

我正在使用 Linode 的生产服务器运行一个小型 Rails 项目。我很想在 staging 中测试一些功能,但我不能证明从 Linode 购买另一台服务器来完美模仿我的生产是合理的。

我目前有两个目录设置:live 和 staging。该站点从“live”文件夹中的应用程序副本运行。当我进入“staging”文件夹并运行“rails s”时,WEBrick 启动到端口 3000。有没有办法从外部访问这个 staging 服务器?我试过 http://wwww.my-ip:3000 但没有运气。

本质上,有没有办法在我的生产服务器的不同端口上临时运行我的暂存应用程序而不影响实时网站?

谢谢, 迈克尔·布特罗斯

【问题讨论】:

  • 您使用的是哪个网络服务器?
  • @Vimsha,我正在使用 mod_rails,所以我不确定您在下面的答案是否适用。
  • 你不能运行 ask mod_rail 来监听两个不同的端口吗?

标签: ruby-on-rails webrick


【解决方案1】:

您可以让网络服务器监听两个不同的端口。一个将是您的默认端口(80)

server {
        listen       3000;
        server_name  localhost; #server_name _; if you want this vh for all projects in your /var/www/ folder.
        root /var/www/project1; # If you want this config for specific project, or else keep it /var/www for all the projects in the www/ folder
    index index.php index.html index.htm;
}

将根目录设置为您的暂存位置,您应该可以像http://www.my-ip:3000 一样访问它

看看this 的帖子。即使你不使用 nginx,它也会给你一个想法

【讨论】:

    猜你喜欢
    • 2016-08-09
    • 2013-08-06
    • 2021-07-01
    • 1970-01-01
    • 2010-09-20
    • 2022-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多