Archive for the ‘Nginx’ Category
Wednesday, April 16th, 2014
It's pretty straightforward to manage file upload. Everybody can do it with using multipart/form-data encoding RFC 1867. Let's see what happens:
client sends POST request with the file content in BODY
webserver accepts the request and initiates data transfer (or returns error 413 if the file size is exceed the limit)
webserver starts ...
Posted in Nginx | No Comments »
Friday, September 4th, 2009
Пример использования модуля:
if ($geoip_country_code = UA) {
rewrite ^ http://myDomain.ua permanent;
}
линк на БД ip'шников
http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
источник http://proxy.org/forum/1246980547.html
Posted in Nginx | No Comments »
Wednesday, August 12th, 2009
ddetect - быстрый аналайзер логов
Борьба с DDOS и DOS на уровне nginx
Posted in Apache, Nginx | No Comments »
Thursday, January 22nd, 2009
Кофиг:
location /get {
secure_link_secret 12344321;
if ($secure_link = "") {
return 403;
}
rewrite ^ /get/$secure_link break;
root /usr/local/www/nginx;
}
Вычисляем ссылку для файла file, лежащего в директории get:
echo -n file12344321 | md5
4cb806deb9dfaa9f197cc867b80f346f
Ссылка на файл:
http://domain.ru/get/4cb806deb9dfaa9f197cc867b80f346f/file
Источник http://bbs.chinaunix.net/archiver/tid-1305018.html
Posted in Nginx | No Comments »
Thursday, June 26th, 2008
Запускаем memcached:
memcached -s /tmp/memcached.sock -a 0655 -u apache -m 32 -vvv
Настраиваем nginx:
server {
listen 0.0.0.0:80;
server_name www.domain.ru;
location / {
root /home/www;
expires 43200s;
index index.php index.html index.htm;
}
location ~ .php$ {
include fastcgi_php5_mc;
fastcgi_param SCRIPT_FILENAME /home/www$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /home/www/;
#Постит в кеш не надо
if ($request_method = POST ) {
fastcgi_pass unix:/tmp/php5.socket; break;
}
set ...
Posted in Nginx | No Comments »
Tuesday, March 4th, 2008
Создаем сертификаты вот такой командой:
openssl req -new -x509 -days 9999 -nodes -out server.crt -keyout server.key
В Common name вписываем имя домена, поля не должны быть пустыми.
Прописываем в nginx:
ssl on;
ssl_certificate ssl/server.crt;
ssl_certificate_key ssl/server.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
Posted in Nginx | No Comments »
Wednesday, February 6th, 2008
При сборке в configure нужно указать --with-http_stub_status_module
Использовать можно так:
location /stub_status {
stub_status on;
allow 192.168.1.0/24;
deny all;
}
Выдаёт примерно такое:
Active connections: 36
server accepts handled requests
5690748 5690748 13977519
Reading: 0 Writing: 1 Waiting: 35
Active connections - сколько обслуживается клиентов.
server
accepts - сколько соединений было accept()нуто;
handled - сколько из них было обработано, а не закрыто сразу;
соединение сразу же ...
Posted in Nginx | No Comments »
Wednesday, January 16th, 2008
server {
server_name www.old-domain.com;
rewrite ^(.*) http://new-domain.com$1 permanent;
}
Posted in Nginx | No Comments »