====== "Страница без денег" на nginx ======
===== Установка nginx на Debian/Ubuntu =====
apt-get install nginx
===== Установка nginx на Centos =====
[[http://wiki.nginx.org/Install#Official_Red_Hat.2FCentOS_packages|Установка ngnix на Centos ]]
===== Установка nginx на FreeBSD =====
Из пакетов
pkg_add -r nginx
Либо из исходников
cd /usr/ports/www/nginx
make config
make install clean
===== Ссылка на официальный сайт =====
[[http://wiki.nginx.org/Install|Установка на официальном сайте ngnix]]
===== Пример конфига для Debian/Ubuntu =====
Слушает на порту 8000 и редиректит на 80й порт апача
при этом апач не нагружен так как nginx кеширует
cat /etc/nginx/nginx.conf
user www-data;
worker_processes 1;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
listen 8000;
server_name localhost;
access_log /var/log/nginx/redirect.access.log;
location / {
if ( $http_user_agent ~ ^uTorrent ) {
return 404;
}
if ( $http_user_agent ~ Windows-Update-Agent ) {
return 404;
}
if ( $http_user_agent ~ "Microsoft NCSI" ) {
return 404;
}
if ( $http_user_agent ~ "ESS Update" ) {
return 404;
}
if ( $http_user_agent ~ "Google Update" ) {
return 404;
}
if ( $http_user_agent ~ "Microsoft-CryptoAPI" ) {
return 404;
}
if ( $http_user_agent ~ "Microsoft BITS" ) {
return 404;
}
if ( $http_user_agent ~ MSDW ) {
return 404;
}
if ( $http_user_agent ~ ^SeaPort ) {
return 404;
}
if ( $http_user_agent ~ ^Windows-Media-Player ) {
return 404;
}
if ( $http_user_agent ~ "Google Update" ) {
return 404;
}
if ( $http_user_agent ~ ^GoogleEarth ) {
return 404;
}
if ( $http_user_agent ~ ^Skype ) {
return 404;
}
if ( $http_user_agent = "MailRuSputnik" ) {
return 404;
}
if ( $http_user_agent ~ ^Ya\.Online ) {
return 404;
}
if ( $http_user_agent ~ ^MRA ) {
return 404;
}
if ( $http_user_agent ~* ^MediaGet ) {
return 404;
}
if ( $http_user_agent ~ ^BTWebClient ) {
return 404;
}
if ( $http_user_agent ~ ^Syncer ) {
return 404;
}
if ( $http_user_agent = "TMUFE" ) {
return 404;
}
if ( $http_user_agent ~ ^Akamai\ NetSession\ Interface ) {
return 404;
}
if ( $http_user_agent ~ ^VKSaver ) {
return 404;
}
if ( $http_user_agent ~ DrWebUpdate ) {
return 404;
}
if ( $http_user_agent = "" ) {
return 404;
}
if ( $host ~ geo\.kaspersky\.com ) {
return 404;
}
if ( $host ~ (su|download|webrep).*\.avast\.com ) {
return 404;
}
if ( $host = wi2geo.mobile.yandex.net ) {
return 404;
}
if ( $host ~ bar.*\.yandex\.ru ) {
return 404;
}
if ( $host ~ (ping|master)\d*\.(dyngate|teamviewer)\.com ) {
return 404;
}
if ( $host ~ sitecheck\d*\.opera\.com ) {
return 404;
}
if ( $host ~ (xml\.my|mailsputnik|maps)\.mail\.ru ) {
return 404;
}
if ( $host = onlineconfigservice.ubi.com ) {
return 404;
}
if ( $host = com-services.pandonetworks.com ) {
return 404;
}
if ( $host ~ ticno\.com ) {
return 404;
}
if ( $host ~ conduit ) {
return 404;
}
if ( $host ~ cbox\.ws ) {
return 404;
}
if ( $host ~ (pricelist|metrics)\.skype\.com ) {
return 404;
}
if ( $host = weather.service.msn.com ) {
return 404;
}
if ( $host = advstat.letitbit.net ) {
return 404;
}
if ( $host = skymonk.net ) {
return 404;
}
if ( $host ~ counter ) {
return 404;
}
if ( $host ~ pluraserver ) {
return 404;
}
if ( $host ~ apps.bittorrent.com ) {
return 404;
}
if ( $host ~ tracker ) {
return 404;
}
if ( $request_uri ~* (update|feed|announce|rss|xml|json|oauth) ) {
return 404;
}
if ( $request_uri ~* (toolbar|suggest) ) {
return 404;
}
if ( $request_filename ~ \.(ico|gif|jpg|png) ) {
return 404;
}
if ( $request_filename ~ \.(css|xml|js|swf|flv) ) {
return 404;
}
if ( $request_filename ~ \.(crl|txt|cab|msi|jar) ) {
return 404;
}
if ( $host ~ norton ) {
return 404;
}
rewrite ^ http://10.0.1.30/ redirect;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
Тут поменять в строке ссылку на свою страницу без денег в apache
rewrite ^ http://10.0.1.30/ redirect;
===== Пример конфига для FreeBSD =====
Слушает на порту 80 и редиректит на 8000й порт апача
при этом апач не нагружен так как nginx кеширует
cat /usr/local/etc/nginx/nginx.conf
#user www-data;
worker_processes 1;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/redirect.access.log;
location / {
if ( $http_user_agent ~ ^uTorrent ) {
return 404;
}
if ( $http_user_agent ~ Windows-Update-Agent ) {
return 404;
}
if ( $http_user_agent ~ "Microsoft NCSI" ) {
return 404;
}
if ( $http_user_agent ~ "ESS Update" ) {
return 404;
}
if ( $http_user_agent ~ "Google Update" ) {
return 404;
}
if ( $http_user_agent ~ "Microsoft-CryptoAPI" ) {
return 404;
}
if ( $http_user_agent ~ "Microsoft BITS" ) {
return 404;
}
if ( $http_user_agent ~ MSDW ) {
return 404;
}
if ( $http_user_agent ~ ^SeaPort ) {
return 404;
}
if ( $http_user_agent ~ ^Windows-Media-Player ) {
return 404;
}
if ( $http_user_agent ~ "Google Update" ) {
return 404;
}
if ( $http_user_agent ~ ^GoogleEarth ) {
return 404;
}
if ( $http_user_agent ~ ^Skype ) {
return 404;
}
if ( $http_user_agent = "MailRuSputnik" ) {
return 404;
}
if ( $http_user_agent ~ ^Ya\.Online ) {
return 404;
}
if ( $http_user_agent ~ ^MRA ) {
return 404;
}
if ( $http_user_agent ~* ^MediaGet ) {
return 404;
}
if ( $http_user_agent ~ ^BTWebClient ) {
return 404;
}
if ( $http_user_agent ~ ^Syncer ) {
return 404;
}
if ( $http_user_agent = "TMUFE" ) {
return 404;
}
if ( $http_user_agent ~ ^Akamai\ NetSession\ Interface ) {
return 404;
}
if ( $http_user_agent ~ ^VKSaver ) {
return 404;
}
if ( $http_user_agent ~ DrWebUpdate ) {
return 404;
}
if ( $http_user_agent = "" ) {
return 404;
}
if ( $host ~ geo\.kaspersky\.com ) {
return 404;
}
if ( $host ~ (su|download|webrep).*\.avast\.com ) {
return 404;
}
if ( $host = wi2geo.mobile.yandex.net ) {
return 404;
}
if ( $host ~ bar.*\.yandex\.ru ) {
return 404;
}
if ( $host ~ (ping|master)\d*\.(dyngate|teamviewer)\.com ) {
return 404;
}
if ( $host ~ sitecheck\d*\.opera\.com ) {
return 404;
}
if ( $host ~ (xml\.my|mailsputnik|maps)\.mail\.ru ) {
return 404;
}
if ( $host = onlineconfigservice.ubi.com ) {
return 404;
}
if ( $host = com-services.pandonetworks.com ) {
return 404;
}
if ( $host ~ ticno\.com ) {
return 404;
}
if ( $host ~ conduit ) {
return 404;
}
if ( $host ~ cbox\.ws ) {
return 404;
}
if ( $host ~ (pricelist|metrics)\.skype\.com ) {
return 404;
}
if ( $host = weather.service.msn.com ) {
return 404;
}
if ( $host = advstat.letitbit.net ) {
return 404;
}
if ( $host = skymonk.net ) {
return 404;
}
if ( $host ~ counter ) {
return 404;
}
if ( $host ~ pluraserver ) {
return 404;
}
if ( $host ~ apps.bittorrent.com ) {
return 404;
}
if ( $host ~ tracker ) {
return 404;
}
if ( $request_uri ~* (update|feed|announce|rss|xml|json|oauth) ) {
return 404;
}
if ( $request_uri ~* (toolbar|suggest) ) {
return 404;
}
if ( $request_filename ~ \.(ico|gif|jpg|png) ) {
return 404;
}
if ( $request_filename ~ \.(css|xml|js|swf|flv) ) {
return 404;
}
if ( $request_filename ~ \.(crl|txt|cab|msi|jar) ) {
return 404;
}
if ( $host ~ norton ) {
return 404;
}
rewrite ^ http://10.0.1.30:8000/ redirect;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
Тут поменять в строке ссылку на свою страницу без денег в apache
rewrite ^ http://10.0.1.30/ redirect;