1

Let's said that I will have a unique development server sharing code for multiple developers. The code for each developer will be on it's home directory under sources so basically it will be something like ~/<developer_name>/sources. That server is running Apache 2.4.x.

I need that each developer could access their code by for example <developer_name>.domain.com. Off course the developer_name on the URL will match the name on the /home directory.

My solution is a Virtual Host per developer on the Apache config, is there any better solution and I am not aware?

2
  • 2
    Dynamically Configured Mass Virtual Hosting and a catch-all DNS record and the only thing you need to do is to create user accounts Commented Nov 1, 2016 at 15:08
  • @HBruijn thats' exactly what I want to achieve although I am a bit lost about catch-all DNS record, how? what do you mean by this? Sorry for my ignorance this is my first time trying to implement this Commented Nov 1, 2016 at 15:24

2 Answers 2

3

We have a similar setup.

The one catch is that you'll want to have a whole subdomain for your server. So instead of jdoe.domain.com & bsmith.domain.com, you'll have jdoe.dev.domain.com and bsmith.dev.domain.com. You can almost think of the 'dev.domain.com' as the server.

You'll probably want to do something like this:

Apache module

Make sure that the vhost_alias module is enabled.

# a2enmod vhost_alias 

Apache config

(the key is the VirtualDocumentRoot directive)

<VirtualHost *:80> ServerName dev.domain.com ServerAlias dev.domain.com *.dev.domain.com VirtualDocumentRoot /home/%1/sources </VirtualHost> 

DNS entry

You need a DNS entry to point dev.domain.com and anything under it (*.dev.domain.com) to your development server.

If you want to get rid of the 'dev' subdomain, you'll have to make a DNS entry for every developer.

A BIND record in the domain.com zone could look like this:

*.dev A 10.1.1.1 
0

Do you need them to have their own domain names? If not, there is the built-in mod_userdir that will do this. Your developers would be at http://developers.domain.com/~<developer_name>/ (such as /~bob/). You would just define UserDir to be "sources" (the default is public_html).

The config is usually in httpd.conf, but you'd just need something like:

LoadModule userdir_module modules/mod_userdir.so <IfModule mod_userdir.c> UserDir sources </IfModule> 

You may also have a UserDir disable that you'll also have to comment out.

1
  • Sadly yes, the application work with licenses based on domains! but anyway is helpful too I have two ways to get it done now :) Commented Nov 1, 2016 at 22:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.