Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Several people have got a single domain name server.company.com server, where they are now supposed to host their infrastructure or temporal projects, written in different ways even in different programming languages. How do they divide the domain?

  1. Split into subdomains: john.server.company.com, kate.server.company.com, etc.
    This would need a lot of admins' assistance, time, etc. -- there would be no way for John and Kate to do it themselves.
  2. Split into url namespaces: server.company.com/john/, server.company.com/kate/, etc.
    Pro: They now can make a single welcome page at root with any additional info (if they need?)
    Con: Each server would need to know their namespace string constant, and hrefs like / whould need patching.
  3. Split into ports: server.company.com:8080, server.company.com:8081, etc. and make a single :80 welcome page.
    Pro: They still can make a single welcome page at :80
    Con: ???

I would like to know more pros and cons for 2 and 3 solution.

share|improve this question
    
Wanted tags routing and collaboration. –  Nakilon Dec 26 '13 at 18:02
    
"server" or website? –  w3d Dec 27 '13 at 9:32
    
@w3d, some servers are with dynamic HTML content, some are JSON API. –  Nakilon Dec 27 '13 at 11:18

2 Answers 2

Different content but same language? (guessing PHP here)

Assuming you're using Nginx I would go with something like this for a server configuration:

server {
    listen 80;

    server_name ~^(.+).server.company.com$;

    set $site "";
    if ($host ~ "^(.+).server.company.com$") {
        set $site "/$1";
    }

    root /var/www$site;
    index index.php index.html index.htm;
}

You'd still have a shared root directory of /var/www that contains all "sites" so they can update files there and point to their domains under it. Requests for host john.server.company.com would be served from the /var/www/john root directory. Of course you'll need a DNS wild card entry for anything * at .server.company.com so that you only need to updated DNS settings once. When a new user needs working space all they'd need is to have a working directory created under /var/www and they can access it with their name.server.company.com like everyone else.

Personally, their sharing of working directories for number 2 would depend on what's being done. If the projects are unique unto themselves then I wouldn't have them shared. If it is something as simple as template work then it's probably not a big deal.

Number 3 is completely out - to get to any location you'd have to manually enter the port in the browser's address bar but you could always book mark it I guess.

share|improve this answer

The concept of running multiple sites on a single server is known as "shared hosting." Shared hosting is very common and there are tools that you can install on a server to make it easier: cPanel, Plesk, or Webmin that make setting up sites (including the DNS) more self service for your users.

In all the cases that you mention, you are going to have to do some sort of administration tasks for each user such as adding DNS entries, adding virtual host entries, creating directories, setting permissions, or editing server configuration. The directories doesn't require DNS entries, or much server configuration, just directory creation and permissions, so it is probably easiest from an administration standpoint. The subdomains requires DNS entries and virtual host setup. The port numbers requires setting up a whole server instance running for each, or editing the configuration of a single server to listen on multiple ports then virtual host entries for each one.

share|improve this answer
    
I've got a problem with solution #2. When I try to split servers via nginx.conf, John and Kate have to use the same config file, because it's impossible to declare several server{}s on the same port. But using the same config is a headache. UPD: or is it ok, if I use the same port but different location? –  Nakilon Dec 31 '13 at 2:14
    
You can have several servers listening on the same port in Nginx but only one can be the default server when nothing else matches. –  Dave Lozier Jul 26 at 23:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.