În acest tutorial voi încerca să explic cum să faci corect un FastDL cu ajutorul nginx. Pentru început, de ce nginx? - Este rapid, mai puțin sensibil la atacuri (http flood), și mult mai puțin ambițios la consumul de resurse, decât apache.
Instalarea o voi explica pe baza sistemului de operare Debian, Ubuntu si Centos
Deci ne logăm pe VDS și începem:
Debian/Ubuntu
Code: Select all
apt-get update
apt-get install -y nginx
Code: Select all
yum install -y nginx
Code: Select all
cd /etc/nginx
Code: Select all
rm -f sites-available/default
Code: Select all
nano nginx.conf
Code: Select all
user root;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
tcp_nopush on;
keepalive_timeout 15;
tcp_nodelay on;
directio 5m;
expires max;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
#listen 80;
location / {
root /var/www/;
index index.html index.htm;
set $limit_rate 3m; #limitam viteza de download pana la 3 mb
}
location ~ /(.*)/.*\.cfg { # interzicem downloadarea fisierelor cfg
deny all;
}
location ~ /(.*)/addons/ { # interzicem accesul la addons
deny all;
}
location ~ /(.*)/logs/ { # interzicem accesul la logg-uri
deny all;
}
}
}
Code: Select all
mkdir /var/www
Code: Select all
ln -s /calea/spre/cstrike /var/www/NUME_LINK
Code: Select all
ln -s /home/hlds/cstrike /var/www/fast
Code: Select all
ln -s /home/hlds_zombie/cstrike /var/www/zm
ln -s /home/hlds_pub/cstrike /var/www/pub
Restartăm nginx
Code: Select all
/etc/init.d/nginx restart
Code: Select all
http://IP/fast/maps/de_dust2.bsp
Nu uităm să adăugăm în server.cfg
Code: Select all
sv_downloadurl "http://IP/NUME_LINK/"
sv_allowdownload 1