T
T
Tashiro2014-10-03 10:43:45
PHP
Tashiro, 2014-10-03 10:43:45

How to automate management of virtual hosts on local Ubuntu?

Ubuntu 14.04 is installed on the development machine, there is a standard LAMP, the number of virtual hosts has already exceeded 20, I want to roll Nginx, I mainly work with Bitrix.
At the moment, I manually create each virthost in
/etc/apache2/sites-available/ + make a symlink in ../sites-enabled/*.conf
+ edit /etc/hosts
if I install Nginx, then for it +1 more config for each virtual host. (nginx is needed solely for returning statics, even more for 404 processing, because I often work on copies of sites without pictures, and Apache starts to get dumb with a large number of requests for statics)
the question is, are there any means to automate this entire process? maybe some panel can do that?
PS now I'm sitting on mod_php but I'm thinking of switching to php-fpm

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lynn "Coffee Man", 2014-10-03
@Lynn

Well, for example:

server {
  server_name ~^(?<name>.+)\.example\.com$;
  set $rootdir /var/site/$name;
  root $rootdir;
  ... и т.д.
}

K
Konstantin Andreevich, 2014-10-04
@reffy

There are a ton of solutions on github - https://github.com/search/?q=virtual+hosts+sh&type...
And for myself, in 10 minutes I threw my Bash script. Anything you do with your hands can be done with a .sh script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question