【发布时间】:2023-03-29 08:09:01
【问题描述】:
我正在尝试使用 Phusion Passenger 和 MacOS 上的 Apache2 模块部署我的 Ruby on Rails 应用程序。我相信我已经正确安装了所有依赖项和 gem,并且认为问题出在我的配置文件中。我没有域,所以我尝试使用 localhost 进行部署。
第一个文件是 apache2 Web 服务器的配置,位于/private/etc/apache2/httpd.conf 我想我的问题是ServerName。我还没有公开托管此 Web 应用程序的域。我正在尝试先在本地部署它。我一直在使用localhost:3000 进行开发,并且也希望使用它来部署它。也许我不了解部署和ServerName 的重要内容。
httpd.conf
<VirtualHost *:80>
ServerName localhost.depot
DocumentRoot /Users/rubythree/Documents/agile-web-development-with-rails-5.1/production/depot/public
SetEnv SECRET_KEY_BASE "secret_key_here"
<Directory /Users/rubythree/Documents/agile-web-development-with-rails-5.1/production/depot/public>
AllowOverride all
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
下一个可能存在问题的文件是位于 /private/etc/hosts 的 hosts 文件,我在其中添加了以下行...
主机
127.1.1.1 localhost.depot
我是 Phusion Passenger 和 Apache 的新手,我很确定我在这里的配置文件中遗漏了一些东西。当我在加载一段时间后尝试访问 ip 127.1.1.1 时,浏览器将无法访问服务器。运行curl 127.1.1.1 也不会返回任何内容,它会超时。任何帮助或方向表示赞赏:)
【问题讨论】:
标签: ruby-on-rails apache passenger