3

I know this might be related but I have a script that loads fastcgi-mono-server for defined websites on a configuration file and I need to a new website to the pool without having to reload all fastcgi process.

Doing

nginx -s reload

Just reload each server (website) configuration and I need a smoother process to add a new asp.net website to the current worker process.

1 Answer 1

2

The 'only' way would be to:

  • isolate all fast-cgi processes
  • forward connections to them with NGINX.

NGINX can forward connections toward a pool of fastCGI mono server. You can execute different fastcgi process for each of the website/application and modify you NGINX configuration to point to each of the application depending on the vhost or URL. Adding new sites will only requires a NGINX reload - which will NOT reload the whole mono server, only the NGINX internal forwarding rules.

Additional configuration examples can be found there: http://www.mono-project.com/FastCGI_Nginx

For reference sake, I'm posting the main part: Nginx configuration (as of version 0.7.63) is located in /etc/nginx/nginx.conf (which contains http configuration) and in /etc/nginx/sites-available/default (where is configuration of particular virtual host or hosts). In order to setup ASP.NET or ASP.NET MVC web application, you need to modify virtual host configuration.

NGINX vhost configuration bloc. This forward to a fastcgi process running on port 9000 of the same system. You could be using 9001 for the second apps, etc. You could also be using dedicated servers to run your application, in such case, NGINX becomes a pseudo HTTP load balancer.

server {
     listen   80;
     server_name  www.domain1.xyz;
     access_log   /var/log/nginx/your.domain1.xyz.access.log;

     location / {
             root /var/www/www.domain1.xyz/;
             index index.html index.htm default.aspx Default.aspx;
             fastcgi_index Default.aspx;
             fastcgi_pass 127.0.0.1:9000;
             include /etc/nginx/fastcgi_params;
     }
}

and you control individual mono 'application' with:

fastcgi-mono-server2 /applications=www.domain1.xyz:/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000

Note: Answer edited a few times to provide additional and a more precise solution.

10
  • Doesn't this solution create some overhead on a single server? Can you supply a detailed how-to? Jan 3, 2012 at 14:07
  • Actually, using 2 instances of NGINX would create some overhead. However, re-reading the questions and my answer, I don't see why it would be required to add a second layer of NGINX. The NGINX already act as a load balancer, you simply need to forward to different pool of fastcgi-mono-server ... (run one for each website). They won't be able to use any shared memory, but this isn't as bad as having to kill all site. Jan 3, 2012 at 14:15
  • The idea is to mimic the same isolation we have on IIS using application pools. I don't wan't to kill all sites, just to be able to have control over each on individually. To you have some configuration examples? Jan 3, 2012 at 14:24
  • I really want to give you this +50. Jan 5, 2012 at 21:57
  • 1
    Gave another shot with more precise solution and included a reference and examples. Sorry for the delay ;-) Jan 9, 2012 at 13:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .