2012-07-19 64 views
1

我自己的域名,「peterlee.com.cn」,我在我的域名控制面板添加一條A記錄:Apache2的配置,允許一個子域指向一個機器:端口

RR     Destination IP TTL 
rs.peterlee.com.cn 10.50.10.75  1 hour 

我有一個回報率(Ruby on Rails的)項目上10.50.10.75:9051運行,這意味着用戶可以通過http://10.50.10.75:9051

我想讓用戶通過http://rs.peterlee.com.cn參觀訪問我的RoR應用程序,所以我增加了以下虛擬主機文件/網站:

<VirtualHost *:80> 
    ServerName rs.peterlee.com.cn 
    DocumentRoot /usr/website/myapp/current/public 
    PassengerEnabled off 
    ProxyPass/http://127.0.0.1:9051/ 
    ProxyPassReverse/http://127.0.0.1:9051/ 
    RackEnv production 
    RailsEnv production 

    <IfModule mod_rewrite.c> 
     RewriteEngine On 

     # Redirect all requests to the maintenance page if present 
     RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$ 
     RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f 
     RewriteCond %{SCRIPT_FILENAME} !maintenance.html 
     RewriteRule ^.*$ /system/maintenance.html [L] 
    </IfModule> 

</VirtualHost> 

使網站和重新啓動的Apache2後,我試圖http://rs.peterlee.com.cn,它給了我500內部服務器錯誤:

Internal Server Error 

The server encountered an internal error or misconfiguration and was unable to complete your request. 

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error. 

More information about this error may be available in the server error log. 

Apache/2.2.22 (Ubuntu) Server at rs.peterlee.com.cn Port 80 

感謝。

彼得

回答

1

我發現下面的警告在/var/log/apache2/error.log

[Thu Jul 19 10:22:20 2012] [warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule. 
[Thu Jul 19 10:22:20 2012] [warn] proxy: No protocol handler was valid for the URL /favicon.ico. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule. 

所以我啓用以下模塊:

sudo a2enmod proxy proxy_balancer proxy_http 

重新啓動的Apache2後,它的工作!

無論如何。

BTW:

passenger start -a 127.0.0.1 -p 9051 -e production -d 
:我使用客運啓動服務