0

Okay I have edited my question :)

I would like to point all traffic at my dedicated server running Nginx and have that handle 70-80% of the load while also distributing the traffic to some other VPS machines running identical source.

I have generated what I think would be the additional parts to my existing server block:

Could I setup the dedicated machines server block using something like this?

upstream my-servers {
    ip_hash;
    server 127.0.0.1:80 weight=8; #Dedicated
    server x.x.x.x:80 weight=2; # VPS1
    server x.x.x.x:80 weight=2; # VPS2
    server x.x.x.x:80 weight=2; # VPS3
 }

 location / {
     proxy_pass http://my-servers;

     etc....
 }

would specifying the localhost like that be valid?

Here is my current working config:

server {

listen 80;

root /var/www/vhosts/www.domain.co.uk/;

index index.php;

server_name domain.co.uk www.domain.co.uk;

gzip  on;
gzip_static on;
gzip_http_version 1.0;
gzip_disable "MSIE [1-6].";
gzip_vary on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 180;
fastcgi_intercept_errors off;

location / {
    try_files $uri $uri/ /index.php;

    if ($http_host ~* "^domain.co.uk"){
    rewrite ^(.*)$ http://www.domain.co.uk$1 redirect;
    }        
}

location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+.php)(.*)$;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
include    fastcgi_params;
}

}

The site is actually PHP but its a proxy script serving other sites web pages there is still no database.

  • It's not very clear what you want. You want the DNS to point to one server which will then load-balance the requests? This is possible, of course, and widely done, but I don't know what benefit it would give you on a purely static site. Instead, I'd probably check how to enhance client caching, make sure the filesystem is optimized, verify the machine has enough resources and maybe add a second dedicated server. You have a 24-core dedicated server and 3 VPS make a difference?! (And please fix the punctuation.) – Antonis Christofides Aug 05 '14 at 10:02
  • right yeah its not that clear sorry. What I would like is what you suggest EG the dedicated server be the only entry in the DNS so all traffic is directed towards that. But then I would like it to distribute the load between 3 other servers and itself using the weight options –  Aug 05 '14 at 10:07
  • You got static site with high traffic. What kind of files you got on it? Can you show can you us your nginx.conf? – redbass Aug 05 '14 at 10:22
  • Done :) the site is PHP and its a proxy site which fetches other sites and renders them on behalf of the user. there is still not database so I personally class this as static. –  Aug 05 '14 at 10:36
  • And it's not nginx.conf ) I mean /etc/nginx/nginx.conf not /etc/nginx.conf.d/*.conf I also interested in worker_processes and worker_connections ? Because i can't believe that 24 core cpu can't handle so much load. – redbass Aug 05 '14 at 10:44
  • @redbass note that remarks of this nature should be posed as Comments (once you have enough reputation, that is). – Felix Frank Aug 05 '14 at 10:46
  • The Dedicated machine is one of a few VM's running on my EXSI 5.5 box. Its not so much the load of the dedicated that's the issue I know it can handle all the load but the site can become slow loading videos etc due the bandwidth. adding some additional VPS's reduce that bottleneck. currently pushing over 600GB daily –  Aug 05 '14 at 10:48
  • @FelixFrank can't because not enough reputation) – redbass Aug 05 '14 at 10:54

0 Answers0