M
M
Maxim Medvedev2016-03-15 20:50:59
Apache HTTP Server
Maxim Medvedev, 2016-03-15 20:50:59

How to make automatic creation of subdomains in ubuntu?

Hello,
I'm trying to make separate subdomains for each login for site users.
The settings in /etc/apache2/sites-available/single.dev.conf state the following:

<VirtualHost *:81>
  ServerAdmin [email protected]
  ServerName single.dev
  ServerAlias *.single.dev
  
  DocumentRoot /www/single.dev
  <Directory /www/single.dev>
    AllowOverride All
  </Directory>
</VirtualHost>

/etc/hosts says:
127.0.0.1 single.dev
the problem is that www.single.dev doesn't open with all my settings.
I'm trying to make it so that all subdomains of a site automatically point to a specific address. For testing, I use single.dev/profile/{user id}. How to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikon_NLG, 2016-03-16
@Nikon_NLG

You cannot solve your problem only through /etc/hosts.
If you have dnsmasq installed, just add the line
address=/.single.dev/127.0.0.1 to your settings.
Note that this will only work from your machine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question