Главная :: Форум :: Web ClipArt :: Поиск :: Статистика :: Топ 10 :: Публикация :: Рекомендовать
netadmin.ws
Панель управления Регистрция свободна! Календарь Список пользователей Часто задаваемые вопросы Поиск по форуму Архив скриптов Главная   
Форум сетевых администраторов
Форум сетевых администраторов Форум сетевых администраторов » Cерверы » Apache » Как настроить вэб-сервер
Предыдущая тема     Следующая тема
Автор
Тема    Новая тема     Ответить на эту тему
Tagore
Сибиряк
Средний рейтинг: 3.58 | Оценок: 31
/нажмите чтобы посмотреть кто оценивал/

Зарегистрирован: Sep 2002
Место проживания: Новосибирск
Публикаций: 1255
Статус: Tagore в оф-лайне
Как настроить вэб-сервер [сообщение #67306]

Recipe 4.12 Displaying the Same Content on Several Addresses



Problem



You want to have the same content displayed on two of your addresses.



Solution



Specify both addresses in the <VirtualHost> directive:



NameVirtualHost 192.168.1.1NameVirtualHost 172.20.30.40<VirtualHost 192.168.1.1 172.20.30.40> DocumentRoot /www/vhosts/server ServerName server.example.com ServerAlias server</VirtualHost>





Recipe 5.5 Aliasing Several URLs with a Single Directive



Problem



You want to have more than one URL map to the same directory but don't want multiple Alias directives.



Solution



Use AliasMatch in http.conf to match against a regular expression:



AliasMatch ^/pupp(y|ies) /www/docs/small_dogs





Recipe 5.11 Replacing Text in Requested URLs



Problem



You want to change all occurrences of string1 to string2 in a request's URI.



Solution



RewriteCond %{REQUEST_URI} "string1"RewriteRule "(.*)string1(.*)" "$1string2$2" [N,PT]





Recipe 5.14 Rewriting Based on the Query String



Problem



You want to translate one URI into another based on the value of the query string.



Solution



Put this in your httpd.conf:



RewriteCond "%{QUERY_STRING}" "^user=([^=]*)"RewriteRule "/userdirs" "http://%1.users.example.com/" [R]Discussion



mod_rewrite does not consider the query string as part of the URI for matching and rewriting purposes, so you need to treat it separately. The given example translates requests of the form:



http://example.com/people?user=jones http://jones.users.example.com/ The [R] tells mod_rewrite to direct the browser to the URL constructed by the RewriteRule directive.





Recipe 5.16 Turning Directories into Hostnames



Problem



You want to migrate pathnames under a single hostname to distinct hostnames.



Solution



Use RewriteRule in httpd.conf:



RewriteRule "^/(patha|pathb|pathc)(.*)" "http://$1.example.com$2" [R]RewriteRule "^/([^./]*)(.*)" "http://$1.example.com$2" [R]RewriteRule "^/~([^./]*)(.*)" "http://$1.example.com$2" [R]Discussion



The first recipe redirects requests of the form http://example.com/pathseg/some/file.html to a different host, such as http://pathseg.example.com/some/file.html, but only for those requests in which pathseg is patha, pathb, or pathc.



The second recipe does the same thing, except that any top-level path segment is redirected in this manner.



The third recipe splits the difference, redirecting all "user" requests to distinct hosts with the same name as the user.





Recipe 6.5 Restricting Images from Being Used Off-Site



Problem



Other sites are linking to images on your system, stealing bandwidth from you and incidentally making it appear as though the images belong to them. You want to ensure that all access to your images is from documents that are on your server.



Solution



Add the following lines to the .htaccess file in the directory where the images are, or to the appropriate <Directory> container in the httpd.conf file. Replace the myserver.com with your domain name:



<FilesMatch "\.(jpg|jpeg|gif|png)$"> SetEnvIfNoCase Referer "^http://([^/]*\.)?myserver.com/" local_referrer=1 Order Allow,Deny Allow from env=local_referrer</FilesMatch>In fact, by using the following recipe, you can even go one step further, and return a different image to users accessing your images via an off-site reference:



SetEnvIfNoCase Referer "^http://([^/]*\.)?myserver.com/" local_referrer=1RewriteRule %ENV{local_referer| !1 /Stolen-100x100.png [L]Discussion



The first solution will cause all requests for image files to be refused with a 403 Forbidden status unless the link leading to the request was in one of your own documents. This means that anyone linking to your images from a different web site system will get the error instead of the image, because the referer does not match the approved server name.



Note that this technique can cause problems for requests that do not include a Referer request header field, such as people who visit your site through an anonymising service or who have their browser configured not to send this information.



The second solution is similar to the first, except that it substitutes an image of your choice for the one requested, rather than denying the request. Using the values in the Solution, you can construct a Stolen-100x100.png that has whatever admonitory message or perhaps just some picture that will deter the visitor from "stealing" your images.

__________________
Международное брачное агенство в Сибири.

Сообщить модератору об этом сообщении | Предупреждение | IP: определен

Old Post 29-05-2004 18:55
Нажмите сюда для просмотра профайла Tagore Отправить Персональное сообщение Tagore Посетить домашнию страничку Tagore! Найти сообщения от Tagore Добавить Tagore в свой список друзей Редактировать/Удалить сообщение Ответить Цитируя
w00fer
LOL
Средний рейтинг: 3.67 | Оценок: 18
/нажмите чтобы посмотреть кто оценивал/

Зарегистрирован: May 2002
Место проживания: Ленинград
Публикаций: 448
Статус: w00fer в оф-лайне
[сообщение #67547]

замутил, блин...
блин, попробуй снчала по-русски написать

__________________
Чему **censored**, того не миновать

Сообщить модератору об этом сообщении | Предупреждение | IP: определен

Old Post 06-06-2004 14:39
Нажмите сюда для просмотра профайла w00fer Отправить Персональное сообщение w00fer Посетить домашнию страничку w00fer! Найти сообщения от w00fer Добавить w00fer в свой список друзей Редактировать/Удалить сообщение Ответить Цитируя



Формат времени GMT. Текущее время 09:04.
Новая тема   Ответить на эту тему [ Версия для печати Печать | Отправить эту страницу другу/знакомому! Отправить | Получать уведомления об обновлении этой темы Подписка ] Предыдущая тема     Следующая тема
Навигация по форуму:
Оценка темы:

Правила форума:
Вы не можете создавать новые темы.
Вы не можете отвечать на существующие темы.
Вы не можете прикреплять файлы.
Вы не можете редактировать свои сообщения.
HTML теги выкл.
Спец. код вкл.
Смайлики вкл.
[IMG] тег выкл.
 

Page generated in 0.01077700 seconds (43.73% PHP - 56.27% MySQL) with 26 queries.


  Главная :: Форум :: Web ClipArt :: Поиск :: Статистика :: Топ 10 :: Публикация :: Рекомендовать
©NetAdmin.ws, 2001-2026.
Powered by: vBulletin
Copyright ©2000, 2001, Jelsoft Enterprises Limited.