How should I set up my sub-domain to allow it listen on a port for web socket transfer?

September 11, 2015 578 views
Apache Getting Started Ubuntu

Hello, this may be a really beginner question, but I really want to make sure I'm going in the right direction before investing time in this. Heres what I have.

$TTL 1800 IN SOA 1441944900 10800 3600 604800 1800 1800 IN NS 1800 IN NS 1800 IN NS 1800 IN A 1800 IN A


<VirtualHost *:80>
    DocumentRoot /var/www/fileserver
    <Directory /var/www/fileserver>
        # enable the .htaccess rewrites
        AllowOverride All
        Require all granted


    ErrorLog ${APACHE_LOG_DIR}/error_orlybg.log
    CustomLog ${APACHE_LOG_DIR}/access_orlybg.log combined


My primary domain's virtual host is port 80, my subdomain is also configured to port 80.

On my subdomain, I would like to open a web-socket to send files to store and retrieve remotely. In my configuration for the landing site, it's configured to port 80, does this mean I have to listen/receive/respond through port 80 or could I specify another port on the subdomain like 9090 top open with my websocket program and receive data from

Does the "Virtual Host" address in my conf really mean both my primary and subdomain is really sharing the same set of ports and I can access my 9090 port even from rendering a subdomain redundant?

1 Answer

When using virtualhosts your domains/subdomains are indeed sharing the same set of ports since they share the same IP address. What setting up virtual hosts does is to have your web server provide different content based on the domain or subdomain name being requested. If you open another service on port 9090 it would be available on both domains.

Have another answer? Share your knowledge.