Y
Y
Yuri Kalnin2019-05-27 20:26:27
Apache HTTP Server
Yuri Kalnin, 2019-05-27 20:26:27

How to configure apache webserver this way?

There is a domain.ru domain
, it is directed to the SP 111.112.123.124 , it is
necessary that the domain.ru domain looks at the /var/www/site1 directory,
and all substituted ones automatically look at the /var/www/site2 directory,
but the hello.domain.ru subdomain looks at the directory /var/www/site3
now I have ServerAlias: *.domain.ru looks at /var/www/site1 and it is necessary that at /var/www/site2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2019-05-27
@Haotic

<VirtualHost 111.112.123.124:80>
   		ServerName site1.ru
        ServerAlias www.site1.ru
        ServerAdmin [email protected]
        DocumentRoot  /var/www/site1.ru
        ErrorLog logs/ami-com_error_log
        LogLevel warn
        CustomLog logs/ami-com_access_log combined
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/site1.ru>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                DirectoryIndex index.php index.html index.htm
            Require all granted
        </Directory>
</VirtualHost>

<VirtualHost 111.112.123.124:80>
   		ServerName hello.domain.ru
        ServerAlias www.hello.domain.ru
        ServerAdmin [email protected]
        DocumentRoot  /var/www/site3.ru
        ErrorLog logs/ami-com_error_log
        LogLevel warn
        CustomLog logs/ami-com_access_log combined
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/site3.ru>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                DirectoryIndex index.php index.html index.htm
            Require all granted
        </Directory>
</VirtualHost>

well, write var/www/site2 subdomains in default.conf (there is a default trap for all sites, except for explicitly declared ones)
In general, it's better to use vestacp web panels
- if Linux
ispconfig3 - if you like Linux
brainycp - very functional but usability is so-so.
well, if Windows then openserver

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question