Logo Море(!) аналитической информации!
IT-консалтинг Software Engineering Программирование СУБД Безопасность Internet Сети Операционные системы Hardware
Архив форумов ЦИТФорума
Море(!) вопросов - Море(!) ответов
 
 FAQFAQ   ПоискПоиск   ПользователиПользователи   ГруппыГруппы   РегистрацияРегистрация 
 ПрофильПрофиль   Войти и проверить личные сообщенияВойти и проверить личные сообщения   ВходВход 
Как правильно задавать вопросы

Помогите в апаче настроить виртуальный хост

 
Перейти:  
Этот форум закрыт, вы не можете писать новые сообщения и редактировать старые.   Эта тема закрыта, вы не можете писать ответы и редактировать сообщения.    Список форумов Архив форумов ЦИТФорума -> Unix
Предыдущая тема :: Следующая тема  
Автор Сообщение
grf



Зарегистрирован: 05.04.2005
Сообщения: 1242
Откуда: Москва

СообщениеДобавлено: Вт Май 30 2006 10:57    Заголовок сообщения: Помогите в апаче настроить виртуальный хост Ответить с цитатой

Есть отдельный комп, сейчас не в сети, что было с ним до сего момента, не знаю, на нем есть мандрейк 10.1
В нем есть апач.
Необходимо, что бы при наборе в строке браузера сайта, например www.privet.grf открывалась страничка.
Опыта работе с апачем под линухом у меня нулевой, под виндой, близок к нулю.
Собственно сначала в файле httpd2.conf
Код:

### Main Configuration Section
### You really shouldn't change these settings unless you're a guru
###
ServerRoot /etc/httpd/2.0
#ServerName localhost
#LockFile /etc/httpd/httpd.lock
PidFile /var/run/httpd.pid
ErrorLog logs/error_log
LogLevel warn
DocumentRoot /var/www/html


### Dynamic Shared Object (DSO) Support
###
### You should always leave those three, as they are needed for
### normal use.
### mod_access (Order, Allow, etc..)
### mod_log_config (Transferlog, etc..)
### mod_mime (AddType, etc...)

LoadModule access_module   modules/mod_access.so

.....

LoadModule rewrite_module   modules/mod_rewrite.so


### Global Configuration

# We now support multiple apache configurations on the same server. In
# common.conf, we put all directives that are common to all implementations
# (httpd, httpd-perl, etc.)
# For Apache2 we load all conf files in conf.d
Include /etc/httpd/conf.d/*.conf
Include conf/commonhttpd.conf


###
### IP Address/Port and Proxied configuration section
###
# The APACHEPROXIED setting can be set in /etc/rc.d/init.d/httpd if you
# are using a proxy or accelerator, like the Apache-SGI or khttpd, so that
# the fast web server serves static content while Apache handles the
# cgi or php files

<IfDefine APACHEPROXIED>
    Listen 8080
</IfDefine>
<IfDefine !APACHEPROXIED>
    Listen 80
</IfDefine>



<IfDefine PERLPROXIED>
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^proxy:.*  -  [F]
    RewriteRule ^(.*\/perl\/.*)$  http://%{HTTP_HOST}:8200$1 [P]
    RewriteRule ^(.*\/cgi-perl\/.*)$  http://%{HTTP_HOST}:8200$1 [P]
</IfModule>
</IfDefine>

### Log configuration Section

###<IfModule mod_log_config.c>
#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/Vhost.conf, we use this entry
CustomLog "|/usr/sbin/advxsplitlogfile" vhost env=VLOG
</IfModule>

###
### Virtual Hosts
###
# We include different templates for Virtual Hosting. Have a look in the
# vhosts directory and modify to suit your needs.
Include conf/vhosts/Vhosts.conf
#Include conf/vhosts/DynamicVhosts.conf
#Include conf/vhosts/VirtualHomePages.conf



#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15


# prefork MPM [THIS IS THE DEFAULT]
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers         5
MinSpareServers      5
MaxSpareServers     10
MaxClients         150
MaxRequestsPerChild  0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers           5
StartThreads         5
MinSpareThreads      5
MaxSpareThreads     10
MaxThreadsPerChild  20
MaxRequestsPerChild  0
</IfModule>

###
### webapps configuration section
###

# Web applications should be activated _after_ apache has been
# configured properly.
Include /etc/httpd/webapps.d/*.conf


Я вырезал отсюда чась файла с загрузкой модулей, заменив их многоточием, для уменьшения объема, если необходимо, выложу и этот кусок.
Сначала добавил инфу о виртуальном хосте в конец этого файла, апач не видел страницы - "Такой узел не найден", затем обратил внимание на строку
Код:

### Virtual Hosts
###
# We include different templates for Virtual Hosting. Have a look in the
# vhosts directory and modify to suit your needs.
Include conf/vhosts/Vhosts.conf
#Include conf/vhosts/DynamicVhosts.conf
#Include conf/vhosts/VirtualHomePages.conf

после чего перенес эту инфу в файл vhosts/Vhosts.conf
файл Vhosts.conf выглядит теперь так

Код:

################# Vhosts.conf
#This is where we store the VirtualHosts configuration.
#
#Since Apache 1.3.19, we modified the setup to include some nice tricks:
#
#- We added the User and Group directives so VirtualHosts now work with
#  suexec directive. If set, Apache will run all cgi scripts under that
#  user and group (provided the uid and gid are > 100 for security). The
#  directories and cgi files *must* belong to that user/group for the
#  feature to work
#- We added the Setenv VLOG directive. This works in conjunction with
#  the CustomLog in common.conf. When Setenv VLOG is set, apache will
#  create a /var/log/httpd/VLOG-YYYY-MM-<ServerName>.log instead of logging
#  to access_log. Use this instead of defining a special logfile for
#  each vhost, otherwise you eat up file descriptors.
#- You can also specify a path for the VLOG for each Vhost, for example,
#  to place the logs in each user's directory. However, if you want to
#  use the file for accounting, place it in a directory owned by root,
#  otherwise the user will be able to erase it.
#- I suggest only including the ErrorLog *only* if the vhost will use
#  cgi scripts. Again, it saves file descriptors!
#- We added the Rewrite directives so vhosts will work with the
#  PERLPROXIED configuration


################# Named VirtualHosts
#NameVirtualHost 111.222.33.44
#<VirtualHost 111.222.33.44>
#ServerName www.domain.tld
#ServerPath /domain
#DocumentRoot /web/domain
#</VirtualHost>

NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName www.privet.grf
ServerPath /var/www/html/privet
DocumentRoot /var/www/html/privet/user
</VirtualHost>

Само собой в /var/www/html/privet лежит файл index.htm
Ситуацию это не изменило. После чего я подумал, что собственно откуда известно где искать мою страничку, поэтому по опыту в винде, я исправил файл \etc\hosts, добавив туда инфу о этом сайте
Вот этот файл
Код:

127.0.0.1        localhost.localdomain localhost www.privet.grf
192.168.0.4        partizan.grf

После чего сообщение о ошибки сменилось на отсутствие разрешений для этого узла. На все папки и файлы в /var/www/html/privet разрешения есть у всех, мне казалось достаточно только на чтение и исполнение, но на всякий случай дал еще и на запись.

Апач работает, по крайней мере перестарт происходит без сообщений об ошибке, да и по localhost отражается приветственная страничка мандрейка.
Вернуться к началу
Посмотреть профиль Отправить личное сообщение
grf



Зарегистрирован: 05.04.2005
Сообщения: 1242
Откуда: Москва

СообщениеДобавлено: Вт Май 30 2006 13:07    Заголовок сообщения: Ответить с цитатой

Спасибо, попробую сегодня вечером.
Вернуться к началу
Посмотреть профиль Отправить личное сообщение
grf



Зарегистрирован: 05.04.2005
Сообщения: 1242
Откуда: Москва

СообщениеДобавлено: Чт Июн 01 2006 08:51    Заголовок сообщения: Ответить с цитатой

Цитата:

Так index.html лежит у тебя в /var/www/html/privet, а DocumentRoot /var/www/html/privet/user. Кинь index в /var/www/html/privet/user

Огромное спасибо, помогло!!!!!
Laughing Laughing Laughing
Вернуться к началу
Посмотреть профиль Отправить личное сообщение
Показать сообщения:   
Этот форум закрыт, вы не можете писать новые сообщения и редактировать старые.   Эта тема закрыта, вы не можете писать ответы и редактировать сообщения.    Список форумов Архив форумов ЦИТФорума -> Unix Часовой пояс: GMT + 3
Страница 1 из 1

 
Перейти:  
Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете голосовать в опросах


Powered by phpBB © 2001, 2002 phpBB Group
Русская поддержка phpBB

 

IT-консалтинг Software Engineering Программирование СУБД Безопасность Internet Сети Операционные системы Hardware

Информация для рекламодателей PR-акции, размещение рекламы — adv@citforum.ru,
тел. +7 495 6608306, ICQ 232284597
Пресс-релизы — pr@citforum.ru
Послать комментарий
Информация для авторов
This Web server launched on February 24, 1997
Copyright © 1997-2000 CIT, © 2001-2006 CIT Forum
Внимание! Любой из материалов, опубликованных на этом сервере, не может быть воспроизведен в какой бы то ни было форме и какими бы то ни было средствами без письменного разрешения владельцев авторских прав. Подробнее...