I'm running a Meteor server on my Ubuntu server. But problems arise when I try to have Apache serving a subdomain on the same server.
main.domain.com -> Meteor
sub.domain.com -> Apache
Meteor is running on port 80. I have previously tried to have Meteor run on port 3000 and served in reverse proxy with Nginx, but Meteor started to behave badly (tcp/websockets issues) and I spent too many evenings and nights to persist for my own sake.
So I reverted my setup to have Meteor being the main server (app works fine), and then install Apache the serve my subdomain. The problem is I cannot have Apache serve on port 80 too since it seems to overrun my Meteor server.
From experience, I try to stay away from reverse-proxying Meteor, but I'm not knowledgeable enough to get Apache to dedicate itself to my subdomain and without overwhelming "everything port 80" on my server.
How can I have both services behave with each other in this kind of setup?
Update:
Following EasyEcho suggestion, I turned to using 2 different ip addresses.
Let it be known, I'm using a "Next Generation" Cloud server on Rackspace (running the latest Ubuntu 12.04 LTS with latest grub2/updated kernel.
Rackspace does not allow additional IPs on their Cloud Servers (source)...
The next generation Cloud Servers platform powered by OpenStack does not yet support additional IP addresses.
... but you get 1 IPv4 and 1 IPv6 when creating a server. So why not hop into the IPv6 bandwagon? Easier said than done.
So here is my "new problem": After mapping my subdomain to the IPv6 address (AAAA in DNS) and configuring Apache to listen to the IPv6 address, I get this following behavior:
From my server remote desktop (using freeNX), in Firefox
- http:// [my:ip:v6:address] -> Apache (WIN)
- http:// sub.domain.com -> Apache (WIN)
- http:// my.ip.v4.address -> Meteor (WIN)
- http:// main.domain.com -> Apache (FAIL)
From my workstation (Win7 x64), also in Firefox
- http:// [my:ip:v6:address] -> The connection has timed out (FAIL)
- http:// sub.domain.com -> Server not found (FAIL)
- http:// my.ip.v4.address -> Meteor (WIN)
- http:// main.domain.com -> Meteor (WIN)
Here is my Apache configuration:
/etc/apache2/ports.conf
NameVirtualHost [my:ip:v6:address]:80
Listen [my:ip:v6:address]:80
<IfModule mod_ssl.c>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
/etc/apache2/sites-enabled/default
<VirtualHost [my:ip:v6:address]:80>
ServerAdmin webmaster@localhost
ServerName sub.domain.com
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Can this be fixed to work as "advertised"?