簡體   English   中英

如何在CentO上使用Passenger和Apache激活Rails

[英]How to activate Rails with Passenger and Apache on CentOs

我已經為此努力了幾個小時。 這是我第一次嘗試建立服務器。

我安裝了導軌,乘客和Apache。 在httpd.conf中,這是我寫的:

ServerRoot "/etc/httpd"
# Here I wrote the IP address, since I still did not manage the DNS
Listen ##.##.##.94:80
ServerAdmin root@localhost
ServerName ##.##.##.94:80 # Do I need this?

<Directory />
    AllowOverride none
    Require all denied
    Options Indexes FollowSymLinks Includes ExecCGI
</Directory>

<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-4.0.59
     PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p551/wrappers/ruby
   </IfModule>

<VirtualHost *:80>
      ServerName ##.##.##.##
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /var/www/blah_blah/public_html/public
      <Directory  /var/www/blah_blah/public_html>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
         # Uncomment this if you're on Apache >= 2.4:
         Require all granted
      </Directory>
</VirtualHost>

最后一節是由乘客制作的(我沒有!從說明中復制它:-))。

當我轉到IP地址時,出現一個錯誤,即找不到該頁面。

我有用“ rails s”運行的rails。 在此之前,我重新加載了服務器並重新啟動它以使配置文件生效。 另外,我授予了apache用戶對www文件夾的權限。

問題是什么?

我什至試圖將index.html文件放在rail的公用文件夾中,然后嘗試去那里,但是失敗了。

順便說一句-當我從控制台執行此操作時:

wget http://0.0.0.0:3000

我收到200響應,這表示可以。

哪里錯了?

我認為您應該更改端口:

<VirtualHost *:3000>

因為當您運行rails s它將在端口3000上運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM