Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Doesn't this solution create some overhead on a single server? Can you supply a detailed how-to? –  ruionwriting Jan 3 '12 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. –  CloudWeavers Jan 3 '12 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? –  ruionwriting Jan 3 '12 at 14:24
    
I really want to give you this +50. –  ruionwriting Jan 5 '12 at 21:57
1  
Gave another shot with more precise solution and included a reference and examples. Sorry for the delay ;-) –  CloudWeavers Jan 9 '12 at 13:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.