Nginx - Streamhoster Config (Dedicated 1Gbits)

Status
Not open for further replies.

Entertainment

Active Member
257
2011
10
0
Hey,

i need some help to set the nginx config for file/videohosting. I have searched some information via google but there are always different configs and ways to set up nginx right.

Dedicated Server Details:

1Gbits internet connection (Speedtest about 118-120 MB/s Download/Upload)
8 GB Ram
8TB - 4x 2TB Raid 10 Sata2
64Bit Ubuntu 12.04
CPU: 2 x Intel Hexa-Core Xeon E5645 (12x2.4 GHz)

My nginx Config:

Code:
#user  nobody;
worker_processes  24;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  28;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  15;

    client_body_buffer_size 8K;
    client_header_buffer_size 1k;
    client_max_body_size 2m;
    large_client_header_buffers 2 1k;

    client_body_timeout   10;
    client_header_timeout 10;
    send_timeout          10;
    access_log off;
    error_log /dev/null crit;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;
		limit_rate 200k;
		
		

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

		
		location /files/ { 
			secure_link $arg_st,$arg_e; 
			secure_link_md5 GaylordHunters$uri$arg_e; 			

			if ($secure_link = "") { 
				return 404; 
			}

			if ($secure_link = "0") {
				return 403;
                        }

				mp4; 
			

		}

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

All my files are bigger than 800MB and all the files are .mp4

The Problem is that nginx needs a lot of CPU power and very less Ram.

Upload at 70MB/s - Systemload 18.00 - Ram 800MB.

Would be nice if somebody could help me to set the nginx right or to optimizes it.

All my user will have 200 kb/s for streaming. At 75-80 MB/s upload the speed isnt constant but the server is not limited. The connection to it is still very fast and if i start upload fia FTP Server i could upload with 40 MB/s without loosing speed.
 
3 comments
Status
Not open for further replies.
Back
Top