Aleksey Avdeev пишет:
SKeeper пишет:
Желудков Д.В. пишет:
Есть ли внятный талмуд или инструкция по настройке хотя бы одного name based виртуального хоста на локалхост? Имеющийся опыт настройки в bsd системах и ArchLinux не могу использовать, так как структура конфигов довольно сильно изменена, а настроить надо в сжатые сроки. Подойдет даже очень сжатая инструкция :)
В /etc/httpd2/conf/sites-avialable/vhosts.conf вставляете кусок вида:

<VirtualHost virt-host-name:80>
               ^^^^^^^^^^^^^^^^^
   ServerAdmin [EMAIL PROTECTED]
   DocumentRoot "/var/www/vhosts/virt-host-directory"
   ServerName 127.0.0.1
   ServerAlias www.virt-host-name
   ErrorLog "/var/log/httpd2/virt-host-name-error_log"
   CustomLog /var/log/httpd2/virt-host-name-access_log common
</VirtualHost>

В данном случаи получился vhost использующий оба механизма (по имени и ip).

Чтобы vhost был доступен по данному имени с любых ip (и открытых портов):

<VirtualHost *>
    ServerName <имя vhost>
    ServerAlias <альтернативное имя vhost>
    ...
</VirtualHost>

Просто если вставляю такой кусок, то по запросу на <имя vhost> открывается не то, что лежит в /var/www/vhosts/virt-host-directory, а то что лежит в /var/www/apache2/html/. В чем может быть проблема? В аттаче то как пробовал писать
#
# Summary: Use name-based virtual hosting for *:80
# Provides: NameVirtualHost
#

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
#<VirtualHost *:80>
#       ServerAdmin [EMAIL PROTECTED]
#       DocumentRoot "/www/docs/dummy-host.example.com"
#       ServerName dummy-host.example.com
#       ServerAlias www.dummy-host.example.com
#       ErrorLog "/var/log/httpd2/dummy-host.example.com-error_log"
#       CustomLog "/var/log/httpd2/dummy-host.example.com-access_log common"
#</VirtualHost>
#
#<VirtualHost *:80>
#       ServerAdmin [EMAIL PROTECTED]
#       DocumentRoot "/www/docs/dummy-host2.example.com"
#       ServerName dummy-host2.example.com
#       ErrorLog "/var/log/httpd2/dummy-host2.example.com-error_log"
#       CustomLog "/var/log/httpd2/dummy-host2.example.com-access_log common"
#</VirtualHost>

<VirtualHost *>
        ServerName moodle.local
        ServerAdmin [EMAIL PROTECTED]
        DocumentRoot "/var/www/vhosts/moodle"
        ServerAlias www.moodle.local
        ErrorLog "/var/log/httpd2/moodle.local-error_log"
        CustomLog /var/log/httpd2/moodle.local-access_log common
</VirtualHost>


_______________________________________________
Sysadmins mailing list
[email protected]
https://lists.altlinux.org/mailman/listinfo/sysadmins

Ответить