0

Currently i've successfully pointed my website to my web-server on one subdomain. However; currently its being pointed to port 80 by default.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost         
    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>

I'm looking to hookup the same domain with a different subdomain to :3000 for phonegap; where am I able to configure this?

I assume Phonegap has its own configuration and is not a part of Apache's configuration; i'm still quite unsure due to lack of documentation.

How am I to achieve this on an Ubuntu system?

Oliver Kucharzewski
  • 2,523
  • 4
  • 27
  • 51

1 Answers1

0

Assuming that your phonegap app is running on the same machine and listening on port 3000 for incoming requests and the subdomain you require is, let's say: coreapp2.site.me, you can tweak your apache config such that all requests hitting http://coreapp2.site.me will be proxied to your app.

Something like this should work:

NameVirtualHost *:80

<VirtualHost *:80>

    ServerAdmin webmaster@localhost 

    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>

Make sure that mod_proxy apache module is installed and enabled.

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

And keep the config file at the location /etc/apache2/sites-enabled/coreapp2.conf and restart apache.

Nehal J Wani
  • 16,071
  • 3
  • 64
  • 89