Вот, накидал документацию. Получился эдакий how to. Даже непонятно, хорошо это или
плохо... В целом, приветствуются ваши коментарии, что доработать надо и т.д. Так же
ценятся сообщения об ошибках, ибо конфиги рабочие, и запахивают на серваке.
--------------------------------------------------------------------------------------------------------
Сервер freebsd.
Изначально сервер с FreeBSD отправляет людей в интернет и является
dns сервером, а так же web сервером, на котором установлены виртуальные
хосты и vpn сервером.
Первым делом, необходимо создать свою учетную запись в системе (adduser).
Владелец данной записи должен принадлежать к группе wheel (обязательно, иначе
будут проблемы при использовании sudo, либо su). Необходимо установить
из портов утилиту sudo. Переключившись в root, даем команду:
cd /usr/ports/security/sudo/&& make install clean
После завершения установки, приводим файл конфигурации ee /usr/local/etc/sudoers
к следующему виду:
Код: Выделить всё
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
# Defaults specification
# Runas alias specification
# User privilege specification
root ALL=(ALL) ALL
# Uncomment to allow people in group wheel to run all commands
%wheel ALL=(ALL) ALL
# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
# Samples
# %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users localhost=/sbin/shutdown -h now
Теперь, можно из под своей учетной записи, давать команды от пользователя root.
Набирать при этом, следует свой пароль. было бы неплохо настроить подключение
по ssh к серверу, дабы не бегать каждый раз к консоли. для этого достаточно
внести команду запуска демона в файл /etc/rc.conf
sudo ee /etc/rc.conf
вносим строку
sshd_enable="YES"
затем отредактируем файл /etc/ssh/sshd_config, добавив в него строку с адресом,
который будет слушать (и отзываться) shh:
Собственно, можно добавить строку с внешним ip, дабы управлять сервером из дома
(если потребуется), но в таком случае придется перестраховаться и сделать
дополнительные шаги для защиты сервера от брутфорсеров, коих развелось очень много:
Код: Выделить всё
PermitRootLogin no
MaxAuthTries 3
AllowUsers andy
Первая строка запрещает удаленно логиниться как root, вторая дает максимальное количество
попыток аутентификации, третья строка говорит кто можно пускать из пользователей. При подключении
ssh предполагает, что соединяться следует с текущей учетной записью, исправить положение можно дав команду:
ssh andy@192.168.0.207. Для переписывания файлов на сервер и обратно, надо
воспользоваться командой scp:
Перепишем файл с сервера, на клиент:
Код: Выделить всё
scp /home/andy/root.dmp andy@192.168.0.247:/home/andy/
С клиента на сервер:
Код: Выделить всё
scp andy@192.168.0.247:/home/andy/xorg.conf /home/andy/
Теперь стоит позаботиться о ротации логов, которые могут со временем загадить
все пространство на винчестере. Ротацией логов занимается демон newsyslog,
чей конфигурационный файл находится по адресу /etc/newsyslog.conf. приводим
его к следующему виду:
Код: Выделить всё
# logfilename [owner:group] mode count size when flags [/pid_file]
[sig_num]
/var/log/all.log 600 3 * @T00 J
/var/log/amd.log 644 3 100 * J
/var/log/auth.log 600 3 100 * JC
/var/log/console.log 600 3 100 * J
/var/log/cron 600 3 100 * JC
/var/log/daily.log 640 3 * @T00 JN
/var/log/debug.log 600 3 100 * JC
/var/log/kerberos.log 600 3 100 * J
/var/log/lpd-errs 644 3 100 * JC
/var/log/maillog 640 3 * @T00 JC
/var/log/messages 644 3 100 * JC
/var/log/monthly.log 640 3 * $M1D0 JN
/var/log/pflog 600 3 100 * JB /var/run/pfl
ogd.pid
/var/log/ppp.log root:network 640 3 100 * JC
/var/log/security 600 3 100 * JC
/var/log/sendmail.st 640 3 * 168 B
/var/log/slip.log root:network 640 3 100 * JC
/var/log/weekly.log 640 3 1 $W6D0 JN
/var/log/wtmp 644 3 * @01T05 B
/var/log/xferlog 600 3 100 * JC
/var/log/ntpd.log 644 3 100 * JC
/var/log/relcomeacc.log 600 3 100 * JC
/var/log/relcomerr.log 600 3 100 * JC
/var/log/httpd-access.log 600 3 100 * JC
/var/log/httpd-error.log 600 3 100 * JC
/var/mail/root 640 3 100 * JB
последняя строка говорит о том, что почта для рута тоже складируется и ротируется,
после достижения определенного объема. поэтому, совершенно неплохо бы заглядывать
в этот файл на предмет просмотра отчета о том, что творится в системе и с системой.
Запланировать задания от пользователя root можно отредактировав файл /etc/crontab
После редактирования, запускать его не надо, ибо демон сам догадается об изменениях.
Содержания у файла примерно следующее:
Код: Выделить всё
# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: src/etc/crontab,v 1.32 2002/11/22 16:13:39 tom Exp $
#
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin
HOME=/var/log
#
#minute hour mday month wday who command
#
*/5 * * * * root /usr/libexec/atrun
#
# Save some entropy so that /dev/random can re-seed on boot.
*/11 * * * * operator /usr/libexec/save-entropy
#
# Rotate log files every hour, if necessary.
*/5 * * * * root newsyslog
#
# Perform daily/weekly/monthly maintenance.
1 3 * * * root periodic daily
15 4 * * 6 root periodic weekly
30 5 1 * * root periodic monthly
#
# Adjust the time zone if the CMOS clock keeps local time, as opposed to
# UTC time. See adjkerntz(8) for details.
1,31 0-5 * * * root adjkerntz -a
# Update ports & source collection
0 12 * * * root cvsup -g -L 2 /usr/local/etc/supfile
последняя строка говорит о том, что в 12 часов каждого дня производится обновление
коллекции портов и исходного кода операционной системы. Теперь необходимо
сконфигурировать выход в инет (для начала сервера). Добавим адреса интерфейсов
в файл /etc/rc.conf
Код: Выделить всё
ifconfig_em0="inet 192.168.0.207 netmask 255.255.255.0"
ifconfig_fxp0="inet xxx.xxx.xxx.xxx netmask 255.255.255.252"
defaultrouter="xxx.xxx.xxx.xxx"
#defaultrouter="192.168.0.170"
hostname="freebsd.radiant"
В данной строке первый интерфейс смотрит в локальную сеть, а второй - в мир. шлюзом
по умолчанию, является шлюз MTU. Для того, что бы обращения к серверам в интернете
были возможны по их именам, добавим в файл /etc/resolv.conf информацию о dns
серверах предоставленых нам провайдером:
Код: Выделить всё
domain radiant
nameserver 192.168.0.207
nameserver 212.34.33.1
nameserver 212.34.32.39
Первая строка домен, в котором работает наш сервер, остальные - адреса
dns серверов. Поскольку наш сервер пока не является dns'ом, то первую строку
можно закоментировать. Проверим доступность серверов в интернете:
Код: Выделить всё
andy@freebsd:~> ping -c3 http://www.ru
PING http://www.ru (194.87.0.50): 56 data bytes
64 bytes from 194.87.0.50: icmp_seq=0 ttl=54 time=28.360 ms
64 bytes from 194.87.0.50: icmp_seq=1 ttl=54 time=26.654 ms
64 bytes from 194.87.0.50: icmp_seq=2 ttl=54 time=29.010 ms
Работает. Добавим точности нашим серверным курантам, дописав в файл
/etc/rc.conf строку следующего содержания:
Код: Выделить всё
#world time
ntpdate_enable="YES"
ntpdate_flags="-b europe.pool.ntp.org europe.pool.ntp.org europe.pool.ntp.org"
ntpd_enable="YES"
ntpd_flags="-c /etc/ntp.conf -l /var/log/ntpd.log -p /var/run/ntpd.pid"
Неплохо. Пришло время настроить dns, для того что бы все офисные компы обращались
к серваку и не напрягали прова лишний раз. В файл /etc/namedb/named.conf
пишем следующее:
Код: Выделить всё
// $FreeBSD: src/etc/namedb/named.conf,v 1.21.2.1 2005/09/10 08:27:27 dougb Exp
$
//
// Refer to the named.conf(5) and named(8) man pages, and the documentation
// in /usr/share/doc/bind9 for more details.
//
// If you are going to set up an authoritative server, make sure you
// understand the hairy details of how DNS works. Even with
// simple mistakes, you can break connectivity for affected parties,
// or cause huge amounts of useless Internet traffic.
options {
directory "/etc/namedb";
pid-file "/var/run/named/pid";
dump-file "/var/dump/named_dump.db";
statistics-file "/var/stats/named.stats";
// If named is being used only as a local resolver, this is a safe default.
// For named to be accessible to the network, comment this option, specify
// the proper IP address, or delete this option.
// listen-on { 127.0.0.1; };
// If you have IPv6 enabled on this system, uncomment this option for
// use as a local resolver. To give access to the network, specify
// an IPv6 address, or the keyword "any".
// listen-on-v6 { ::1; };
// In addition to the "forwarders" clause, you can force your name
// server to never initiate queries of its own, but always ask its
// forwarders only, by enabling the following line:
//
// forward only;
// If you've got a DNS server around at your upstream provider, enter
// its IP address here, and enable the line below. This will make you
// benefit from its cache, thus reduce overall DNS traffic in the Internet.
forwarders {
212.34.33.1; 212.34.32.39;
};
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND versions 8 and later
* use a pseudo-random unprivileged UDP port by default.
*/
// query-source address * port 53;
};
// If you enable a local name server, don't forget to enter 127.0.0.1
// first in your /etc/resolv.conf so this server will be queried.
// Also, make sure to enable it in /etc/rc.conf.
zone "." {
type hint;
file "named.root";
};
zone "0.0.127.IN-ADDR.ARPA" {
type master;
file "master/localhost.rev";
};
// RFC 3152
zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA"
{
type master;
file "master/localhost-v6.rev";
};
// NB: Do not use the IP addresses below, they are faked, and only
// serve demonstration/documentation purposes!
//
// Example slave zone config entries. It can be convenient to become
// a slave at least for the zone your own domain is in. Ask
// your network administrator for the IP address of the responsible
// primary.
//
// Never forget to include the reverse lookup (IN-ADDR.ARPA) zone!
// (This is named after the first bytes of the IP address, in reverse
// order, with ".IN-ADDR.ARPA" appended.)
//
// Before starting to set up a primary zone, make sure you fully
// understand how DNS and BIND works. There are sometimes
// non-obvious pitfalls. Setting up a slave zone is simpler.
//
// NB: Don't blindly enable the examples below. :-) Use actual names
// and addresses instead.
zone "radiant" {
type master;
file "master/radiant";
};
zone "0.168.192.IN-ADDR.ARPA" {
type master;
file "master/0.168.192.IN-ADDR.ARPA";
};
В кратце о содержимом. В этом файле описываются зоны, которые держит наш сервер,
прямое и обратное преобразование для них. forwarders - в переменной указаны
dns провайдера, которому будет сообщено, что ranet.ru и r-elcom.ru принадлежат
нам. Для создания файлов с зонами можно воспользоваться скриптом
/etc/namedb/make-localhost. Для этого, надо дать команду sh /etc/named/make-localhost.
Появится файл /etc/namedb/master/localhost.rev,
на основе которого можно сделать описания для зон. Понадобится создать 5 файлов:
0.168.192.IN-ADDR.ARPA, xxxxxxxx, xxxxxxxxxxxxxxxxxxxxxxx, xxxxxxxxxx, radiant.
1. содержимое 0.168.192.IN-ADDR.ARPA
Код: Выделить всё
; From: @(#)localhost.rev 5.1 (Berkeley) 6/30/90
; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter E
xp $
;
; This file is automatically edited by the `make-localhost' script in
; the /etc/namedb directory.
;
$TTL 3600
@ IN SOA freebsd.radiant. root.freebsd.radiant. (
20070702 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS freebsd.radiant.
207 IN PTR freebsd.radiant.
5. содержимое radiant
Код: Выделить всё
; From: @(#)localhost.rev 5.1 (Berkeley) 6/30/90
; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter E
xp $
;
; This file is automatically edited by the `make-localhost' script in
; the /etc/namedb directory.
;
$TTL 3600
@ IN SOA freebsd.radiant. root.freebsd.radiant. (
20070702 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS freebsd.radiant.
freebsd.radiant. IN A 192.168.0.247
При изменении содержимого этих файлов, следует обязательно изменить
серийный номер, иначе изменения не будут приняты вышестоящими серверами. После чего добавить строку в /etc/rc.conf
named_enable="YES"
Проверить правильность конфигурационных файлов можно утилитами named-checkzone и named-checkconf. (named-checkconf /etc/namedb/named.conf). При правильном конфигурировании, серийники должны быть загружены. Теперь настроим маршрутизацию. Для этого
в файл /etc/rc.conf внесем такую строку:
gateway_enable="YES"
Во FreeBSD содержиться пакетный фильтр pf. Загружается фильтр путем добавления
таких строк в файл /etc/rc.conf
pf_enable="YES"
pf_rules="/etc/pf.conf"
Примерный набор правил для файрвола pf (содержаться в файле /etc/pf.conf):
Код: Выделить всё
ext_if="fxp0"
int_if="em0"
vpn_if="{ tun0, tun1, tun2, tun3, tun4, tun5, tun6, tun7, tun8, tun9 }"
ext_add="xxx.xxx.xxx.xxx"
table <bogons> const { 10.0.0.0/8, 172.0.0.0/12, 192.168.0.0/16, 127.0.0.0/8 }
services="{ 21, 22, 25, 53, 80, 110, 123 }"
scrub in all
set skip on lo0
nat on $ext_if from $int_if:network to any -> ($ext_if)
rdr proto tcp from $int_if to port 21 -> 127.0.0.1 port 8021
#block private networks
block in on $ext_if from <bogons> to any
block out on $ext_if from any to <bogons>
block out on $ext_if from <int_if> to any
#allow all on internal interface
pass in on $int_if proto {tcp, udp} from any to any
pass out on $int_if proto {tcp, udp} from any to any
#pass valid service's on external interface
pass in on $ext_if proto {tcp, udp} from $ext_add to any port $services
pass out on $ext_if proto {tcp, udp} from $ext_add to any port $services
# allow vpn connection
pass on $ext_if proto tcp from any to $ext_add port 1723
# allow gre
pass on $ext_if proto gre from any to any
# allow
pass on $vpn_if from any to any
# allow cvsup
pass out on $ext_if proto tcp from $ext_add to any port 5999
Реализуем возможность доступа к локальной сети из вне, то есть создаем vpn
сервер. Будем пользоваться программой poptop.
после инсталляции получаем файлы:
1. /usr/local/etc/pptpd.conf
Который приводим к такому виду:
Код: Выделить всё
option /etc/ppp/options.pptpd
debug
/locanoipparam
localip 192.168.0.207
remoteip 192.168.0.189-199
2. /etc/ppp/options.pptpd
Код: Выделить всё
name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
novj
novjccomp
3. /etc/ppp/ppp.secret
здесь храняться пароли. Формат записи следующий
логин, пароль, ip адрес
4. /etc/ppp/ppp.conf
Код: Выделить всё
pptp:
enable proxy
enable MSChapV2
set timeout 0
set dns 192.168.0.200
set ifaddr 192.168.0.207
Строки после двоеточия начинаются с пробелов или табуляции! Иначе, работать не
будет. Имена файлов конфигурации несколько разняться с теми, что представлены
на сайте poptop. Дело в том, что демон ppp во FreeBSD немного отличается от
Linux'ового. Поэтому, небольшие различия в настройках имеют место быть.
Строка в /etc/rc.conf для запуска poptop такая:
pptpd_enable="YES"
Теперь необходимо установить и настроить Apache и виртуальные хосты, дабы
посетители редиректились на нужный сервер, у провайдера.
Внимание! Поскольку конфигурационный файл достаточно емкий, была сделана выборка
строк, в которых остутствовал символ комментария #. Для приведения конфигурационного файла к нормальному бою, надо различия добавить ручками, либо написать скрипт
Код: Выделить всё
andy@freebsd:~> more /usr/local/etc/apache/httpd.conf | grep -v ^#
ServerType standalone
ServerRoot "/usr/local"
PidFile /var/run/httpd.pid
ScoreBoardFile /var/run/httpd.scoreboard
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 150
MaxRequestsPerChild 0
LoadModule mmap_static_module libexec/apache/mod_mmap_static.so
LoadModule vhost_alias_module libexec/apache/mod_vhost_alias.so
LoadModule env_module libexec/apache/mod_env.so
LoadModule config_log_module libexec/apache/mod_log_config.so
LoadModule mime_magic_module libexec/apache/mod_mime_magic.so
LoadModule mime_module libexec/apache/mod_mime.so
LoadModule negotiation_module libexec/apache/mod_negotiation.so
LoadModule status_module libexec/apache/mod_status.so
LoadModule info_module libexec/apache/mod_info.so
LoadModule includes_module libexec/apache/mod_include.so
LoadModule autoindex_module libexec/apache/mod_autoindex.so
LoadModule dir_module libexec/apache/mod_dir.so
LoadModule cgi_module libexec/apache/mod_cgi.so
LoadModule asis_module libexec/apache/mod_asis.so
LoadModule imap_module libexec/apache/mod_imap.so
LoadModule action_module libexec/apache/mod_actions.so
LoadModule speling_module libexec/apache/mod_speling.so
LoadModule userdir_module libexec/apache/mod_userdir.so
LoadModule alias_module libexec/apache/mod_alias.so
LoadModule rewrite_module libexec/apache/mod_rewrite.so
LoadModule access_module libexec/apache/mod_access.so
LoadModule auth_module libexec/apache/mod_auth.so
LoadModule anon_auth_module libexec/apache/mod_auth_anon.so
LoadModule db_auth_module libexec/apache/mod_auth_db.so
LoadModule digest_module libexec/apache/mod_digest.so
LoadModule proxy_module libexec/apache/libproxy.so
LoadModule cern_meta_module libexec/apache/mod_cern_meta.so
LoadModule expires_module libexec/apache/mod_expires.so
LoadModule headers_module libexec/apache/mod_headers.so
LoadModule usertrack_module libexec/apache/mod_usertrack.so
LoadModule log_forensic_module libexec/apache/mod_log_forensic.so
LoadModule unique_id_module libexec/apache/mod_unique_id.so
LoadModule setenvif_module libexec/apache/mod_setenvif.so
LoadModule php5_module libexec/apache/libphp5.so
ClearModuleList
AddModule mod_mmap_static.c
AddModule mod_vhost_alias.c
AddModule mod_env.c
AddModule mod_log_config.c
AddModule mod_mime_magic.c
AddModule mod_mime.c
AddModule mod_negotiation.c
AddModule mod_status.c
AddModule mod_info.c
AddModule mod_include.c
AddModule mod_autoindex.c
AddModule mod_dir.c
AddModule mod_cgi.c
AddModule mod_asis.c
AddModule mod_imap.c
AddModule mod_actions.c
AddModule mod_speling.c
AddModule mod_userdir.c
AddModule mod_alias.c
AddModule mod_rewrite.c
AddModule mod_access.c
AddModule mod_auth.c
AddModule mod_auth_anon.c
AddModule mod_auth_db.c
AddModule mod_digest.c
AddModule mod_proxy.c
AddModule mod_cern_meta.c
AddModule mod_expires.c
AddModule mod_headers.c
AddModule mod_usertrack.c
AddModule mod_log_forensic.c
AddModule mod_unique_id.c
AddModule mod_so.c
AddModule mod_setenvif.c
AddModule mod_php5.c
Port 80
User www
Group www
ServerAdmin xxxx@xxxxx.xx
ServerName XXX.XXX.XXX.XXX
DocumentRoot "/usr/local/www/data"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/usr/local/www/data">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule mod_userdir.c>
UserDir public_html
</IfModule>
<IfModule mod_dir.c>
<IfModule mod_php3.c>
<IfModule mod_php4.c>
DirectoryIndex index.php index.php3 index.html
</IfModule>
<IfModule !mod_php4.c>
DirectoryIndex index.php3 index.html
</IfModule>
</IfModule>
<IfModule !mod_php3.c>
<IfModule mod_php4.c>
DirectoryIndex index.php index.html
</IfModule>
<IfModule !mod_php4.c>
DirectoryIndex index.html
</IfModule>
</IfModule>
</IfModule>
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</Files>
UseCanonicalName On
<IfModule mod_mime.c>
TypesConfig /usr/local/etc/apache/mime.types
</IfModule>
DefaultType text/plain
<IfModule mod_mime_magic.c>
MIMEMagicFile /usr/local/etc/apache/magic
</IfModule>
HostnameLookups Off
ErrorLog /var/log/httpd-error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/httpd-access.log combined
ServerSignature On
<IfModule mod_alias.c>
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
Alias /icons/ "/usr/local/www/icons/"
<Directory "/usr/local/www/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
# This Alias will project the on-line documentation tree under /manual/
# even if you change the DocumentRoot. Comment it if you don't want to
# provide access to the on-line documentation.
#
Alias /manual/ "/usr/local/share/doc/apache/"
<Directory "/usr/local/share/doc/apache">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/usr/local/www/cgi-bin/"
#
# "/usr/local/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</IfModule>
<IfModule mod_autoindex.c>
#
# FancyIndexing is whether you want fancy directory indexing or standard
#
IndexOptions FancyIndexing
#
# AddIcon* directives tell the server which icon to show for different
# files or filename extensions. These are only displayed for
# FancyIndexed directories.
#
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
#
# DefaultIcon is which icon to show for files which do not have an icon
# explicitly set.
#
DefaultIcon /icons/unknown.gif
#
# AddDescription allows you to place a short description after a file in
# server-generated indexes. These are only displayed for FancyIndexed
# directories.
# Format: AddDescription "description" filename
#
#AddDescription "GZIP compressed document" .gz
#AddDescription "tar archive" .tar
#AddDescription "GZIP compressed tar archive" .tgz
#
# ReadmeName is the name of the README file the server will look for by
# default, and append to directory listings.
#
# HeaderName is the name of a file which should be prepended to
# directory indexes.
#
ReadmeName README.html
HeaderName HEADER.html
#
# IndexIgnore is a set of filenames which directory indexing should ignore
# and not include in the listing. Shell-style wildcarding is permitted.
#
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
</IfModule>
<IfModule mod_mime.c>
#
# AddLanguage allows you to specify the language of a document. You can
# then use content negotiation to give a browser a file in a language
# it can understand.
#
# Note 1: The suffix does not have to be the same as the language
# keyword --- those with documents in Polish (whose net-standard
# language code is pl) may wish to use "AddLanguage pl .po" to
# avoid the ambiguity with the common suffix for perl scripts.
#
# Note 2: The example entries below illustrate that in quite
# some cases the two character 'Language' abbreviation is not
# identical to the two character 'Country' code for its country,
# E.g. 'Danmark/dk' versus 'Danish/da'.
#
# Note 3: In the case of 'ltz' we violate the RFC by using a three char
# specifier. But there is 'work in progress' to fix this and get
# the reference data for rfc1766 cleaned up.
#
# Danish (da) - Dutch (nl) - English (en) - Estonian (ee)
# French (fr) - German (de) - Greek-Modern (el)
# Italian (it) - Korean (kr) - Norwegian (no) - Norwegian Nynorsk (nn)
# Portugese (pt) - Luxembourgeois* (ltz)
# Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cs)
# Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)
# Russian (ru)
#
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage he .he
AddCharset ISO-8859-8 .iso8859-8
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage kr .kr
AddCharset ISO-2022-KR .iso-kr
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage ltz .lu
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .sv
AddLanguage cs .cz .cs
AddLanguage ru .ru
AddLanguage zh-TW .zh-tw
AddCharset Big5 .Big5 .big5
AddCharset WINDOWS-1251 .cp-1251
AddCharset CP866 .cp866
AddCharset ISO-8859-5 .iso-ru
AddCharset KOI8-R .koi8-r
AddCharset UCS-2 .ucs2
AddCharset UCS-4 .ucs4
AddCharset UTF-8 .utf8
# LanguagePriority allows you to give precedence to some languages
# in case of a tie during content negotiation.
#
# Just list the languages in decreasing order of preference. We have
# more or less alphabetized them here. You probably want to change this.
#
<IfModule mod_negotiation.c>
LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
</IfModule>
<IfModule mod_php3.c>
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .php3s
</IfModule>
<IfModule mod_php4.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>
#
# AddType allows you to tweak mime.types without actually editing it, or to
# make certain files to be certain types.
#
AddType application/x-tar .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
#AddType application/x-compress .Z
#AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers",
# actions unrelated to filetype. These can be either built into the server
# or added with the Action command (see below)
#
# If you want to use server side includes, or CGI outside
# ScriptAliased directories, uncomment the following lines.
#
# To use CGI scripts:
#
#AddHandler cgi-script .cgi
#
# To use server-parsed HTML files
#
#AddType text/html .shtml
#AddHandler server-parsed .shtml
#
# Uncomment the following line to enable Apache's send-asis HTTP file
# feature
#
#AddHandler send-as-is asis
#
# If you wish to use server-parsed imagemap files, use
#
#AddHandler imap-file map
#
# To enable type maps, you might want to use
#
#AddHandler type-map var
</IfModule>
<IfModule mod_setenvif.c>
#
# The following directives modify normal HTTP response behavior.
# The first directive disables keepalive for Netscape 2.x and browsers that
# spoof it. There are known problems with these browser implementations.
# The second directive is for Microsoft Internet Explorer 4.0b2
# which has a broken HTTP/1.1 implementation and does not properly
# support keepalive when it is used on 301 or 302 (redirect) responses.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
#
# The following directive disables HTTP/1.1 responses to browsers which
# are in violation of the HTTP/1.0 spec by not being able to grok a
# basic 1.1 response.
#
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
</IfModule>
<VirtualHost xxxxxxxxxx>
ErrorLog /var/log/relcomerr.log
CustomLog /var/log/relcomeacc.log common
Redirect / http://xxxxxxxxxxxxxx
</VirtualHost>
andy@freebsd:~>
Виртульный хост указан толко один, поскольку все зоны, сидят на одном
ip. Поэтому разницы нет, по какому имени к нам обращаются - результат один -
редирект на xxxxxxxxxx.
Добавляем строку, для запуска Apache'а при загрузке в
/etc/rc.conf
apache_enable="YES"