2017-02-25 99 views
0

目前我已成功將我的網站指向我的網站服務器上的一個子域名。然而;目前它默認指向端口80。將域名指向Phonegap端口

<VirtualHost *:80> 
    ServerAdmin [email protected]   
    ServerName coreapp.site.me 
    ServerAlias www.coreapp.site.me 
    DocumentRoot /var/www/coreapp/public 
    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
    <Directory /var/www/coreapp/public> 
     Options Indexes FollowSymLinks 
     AllowOverride All 
     Require all granted 
    </Directory> 
</VirtualHost> 

我在找一個不同的子域連接到同一個域:3000 for phonegap;我可以在哪裏配置?

我認爲Phonegap有它自己的配置,不是Apache配置的一部分;由於缺乏文檔,我仍然很不確定。

我如何在Ubuntu系統上實現這個功能?

回答

0

假設你的phonegap應用程序運行在同一臺機器上,並監聽端口3000的傳入請求和你需要的子域名,讓我們說:coreapp2.site.me,你可以調整你的apache配置,使所有請求點擊http://coreapp2.site.me將被proxied添加到您的應用中。

像這樣的東西應該工作:

NameVirtualHost *:80 

<VirtualHost *:80> 

    ServerAdmin [email protected] 

    ServerName coreapp2.site.me 
    ServerAlias www.coreapp2.site.me 

    ProxyPreserveHost On  

    ErrorLog ${APACHE_LOG_DIR}/app2_error.log 
    CustomLog ${APACHE_LOG_DIR}/app2_access.log combined 

    ProxyPassReverse/http://127.0.0.1:3000/ Keepalive=On 
    ProxyPass/http://127.0.0.1:3000/ Keepalive=On 

</VirtualHost> 

確保mod_proxy Apache模塊安裝並啓用。

sudo apt-get install libapache2-mod-proxy-html 
sudo a2enmod proxy 
sudo a2enmod proxy_http 
sudo a2enmod proxy_html 

並將配置文件保存在位置/etc/apache2/sites-enabled/coreapp2.conf並重新啓動apache。