配置迁移的Rails应用程序-如何说服Apache指向我的应用程序?

0x6upsns  于 2022-11-16  发布在  Apache
关注(0)|答案(2)|浏览(103)

我如何让Apache指向Rails应用程序?我在/var/www中有我的Rails应用程序,并且我成功地安装了Passenger、Ruby、Rails、MySQL。这是一个新的服务器,我只是尝试将一个现有的生产Rails应用程序移到它。我想它可能是httpd.conf中的一些内容,但是在运行的服务器的conf中没有对应用程序的引用。

更新

我已经更新了我的httpd.conf与客运线路:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0
PassengerRuby /usr/local/bin/ruby

此外,我还有一个vhosts文件,它与原始文件完全相同:

<VirtualHost *:80>
   ServerAdmin admin@ourdomain.com
   DocumentRoot /var/www/tutorials/public
   ServerName tutorials.ourdomain.local
   ErrorLog logs/tutorials_error.log
   CustomLog logs/tutorials_access.log common
</VirtualHost>

更新2

我发现我可以通过注解掉welcome. conf的所有行来停止提供默认的Apache页面。现在我得到了403禁止页面“你没有权限访问/在此服务器上”,尽管我对应用程序目录及其内容(和/var/www)进行了777次修改。

更新3

我发现可以通过转到[ipaddress]/findex. html来访问默认的Rails页面。

fhg3lkii

fhg3lkii1#

您必须编辑Apache配置文件,如下所示:

LoadModule passenger_module /somewhere/passenger-x.x.x/ext/apache2/mod_passenger.so

PassengerRuby /usr/bin/ruby
PassengerRoot /somewhere/passenger/x.x.x
PassengerMaxPoolSize 10

<VirtualHost *:80>
    ServerName www.myapp.com
    DocumentRoot /www/myapp/public
    <Directory /www/myapp/public>
        Allow from all
    </Directory>
</VirtualHost>

有关Phusion Passenger users guide for Apache的更多信息。

zzzyeukh

zzzyeukh2#

SELinux是罪魁祸首。Setenforce为0,服务httpd重新启动证明了这一事实。

相关问题