How to make it so that you do not edit httpd.conf + hosts each time, and so that virtual hosts are automatically created (as in Denwer for example)? System WinXP Home .

п.с. its build apache + php + mysql .

    2 answers 2

    <sup> Question on rootcode </ sup>

    Here is a very good article on this topic . An article about Linux, but for Windows it can also be built.

    The protagonist is mod_vhost_alias .

    The module organizes the dynamic creation of virtual hosts based on the requested domain name and does not require changes to the server configuration files when creating new virtual hosts

    If you are lucky with the router, and there is something like DD-WRT , then you can not install bind, but limit yourself to setting up the DNS zone on the router. If you are unlucky, here is an article about setting up bind on XP.

    • I have a local server. Please, никаких Linux (I see a lot of articles in google about linux and almost nothing on xp). - Smash
    • mod_vhost_alias configured on Windows absolutely similar to Linux. Is that the paths to files and directories other. And the DNS server setting on XP is given by reference. - mantigatos
    • error: [Sat Feb 09 17:57:10 2013] [error] [client 127.0.0.1] File does not exist: C:/LocalS/sites/home/_ - Smash

    you can do it

    in .htaccess in DOCUMENT_ROOT default entry

     RewriteEngine on RewriteBase / RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{DOCUMENT_ROOT}/%{HTTP_HOST}/ -d RewriteRule ^(.*)$ %{HTTP_HOST}/$1 [L] 

    and in DOCUMENT_ROOT is a tree

     mysite.com/ mysite2.com/ 

    etc

    but this is a very rude decision ... from chamber 6

    about non-writing in hosts ... the whole point is that somewhere you need to prescribe the way your local computer will refer to 127.0.0.1, as @mantigatos dns said, you need the server.

    • so will all sites link or what? - Smash
    • eicto not understanding your speech. The above method will make a "vhost-type" all domains to which the request comes to your workstation, and for which there is a directory like DOCROOT / HOSTNAME - zb '
    • In general, I do not understand the difficulty of copying the file to the sites.d config directory and correcting a couple of lines there. - zb '
    • I’ve been setting up this article: habrahabr.ru/post/139792 just didn’t understand exactly where to register 127.0.0.1 to refer to everything where necessary. - Smash