简体   繁体   English

使用Passenger和Apache部署Ruby on Rails应用程序

[英]Deploying Ruby on Rails App using Passenger & Apache

I am trying to deploy my Ruby on Rails application using Phusion Passenger and the Apache2 module on MacOS. 我正在尝试使用Phusion Passenger和MacOS上的Apache2模块部署我的Ruby on Rails应用程序。 I believe I have installed all dependencies and gems correctly and think a problem lies in my configuration files. 我相信我已经正确安装了所有依赖项和gem,并认为我的配置文件存在问题。 I do not have a domain so I am trying to use localhost to deploy. 我没有域名,所以我尝试使用localhost进行部署。

this first file is the configuration for the apache2 web server and is located in /private/etc/apache2/httpd.conf I think my issue is with the ServerName . 第一个文件是apache2 Web服务器的配置,位于/private/etc/apache2/httpd.conf我认为我的问题是ServerName I do not have a domain to publicly host this web application from yet. 我还没有域名公开托管此Web应用程序。 I am trying to locally deploy it first. 我想先在本地部署它。 I have been using localhost:3000 for my development and want to deploy it using that as well. 我一直在使用localhost:3000进行开发,并希望使用它进行部署。 Maybe I am not understanding something vital here with deploying and ServerName . 也许我不了解部署和ServerName这里至关重要的东西。

httpd.conf 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>

the next file where an issue might be is the hosts file located in /private/etc/hosts where I added the following line... 问题可能出现的下一个文件是位于/private/etc/hosts中的hosts文件,其中我添加了以下行...

hosts 主机

127.1.1.1     localhost.depot

I am new to Phusion Passenger and Apache and am pretty sure I am missing something in my configuration files here. 我是Phusion Passenger和Apache的新手,我很确定我在配置文件中遗漏了一些东西。 When i try to access the ip 127.1.1.1 after a while of loading the browser will not be able to reach the server. 当我尝试访问ip 127.1.1.1一段时间后加载浏览器将无法访问服务器。 running curl 127.1.1.1 will not return anything either, it will timeout. 运行curl 127.1.1.1也不会返回任何内容,它会超时。 Any help or direction is appreciated :) 任何帮助或方向表示赞赏:)

Even if ServerName does not match - apache will serve the first virtualhost as default. 即使ServerName不匹配 - apache将默认为第一个虚拟主机提供服务。

"This machine" address is 127.0.0.1 , also make sure apache is actually running and has no errors in logs “此机器”地址为127.0.0.1 ,也确保apache实际运行且日志中没有错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM