Nginx/FastCGI return 500 Internal Server Error when sending many requests

I’ve deployed Asp.Net Webservice to connect to Riak on Ubuntu 16.04 using latest version of Mono, FastCGI and Nginx. The Webservice works fine when I access it on my browser. It also works fine if I send one request and wait for response before sending another request. The problem occur when I tried to send many requests at the same time (using www class in Unity3D Engine). From my testing I can only send request up to 7 requests simultaneously. More than that and Nginx/FastCGI would return 500 Internal Server Error. Log file has an access log for this error request.

x.x.x.x - - [27/Mar/2017:10:35:20 +0000] “POST /RiakService.asmx/GetValueMapBucket HTTP/1.1” 500 53 “-” “UnityPlayer/5.5.2f1 (” “-”

But there is no error log in /var/log/nginx/error.log relate to this error request. So, it doesn’t help at all. My Webservice code shouldn’t have any problem because I’ve tested sending 10 requests on xsp4 instead of Nginx/FastCGI. It works correctly. Every request return correct result and no error. Is there any configuration in Nginx/FastCGI relate to this behavior? This is my Nginx configuration for proxy server.

server { location ~.asmx(.) { fastcgi_split_path_info ^(.+.asmx)(.)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; include /usr/local/nginx/conf/fastcgi_params; fastcgi_pass; } }

I tried using debug mode. These are log files when I sent 10 requests. All requests returned 500 Internal Server Error. I’m still a novice in this field. I really appreciate any help.


The above configuration is old and some characters were removed when I posted. This is my current configuration file.

server {
   error_log /var/log/nginx/riakclient.log debug;

   location ~\.asmx(.*) {
     fastcgi_split_path_info ^(.+\.asmx)(.*)$;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     fastcgi_param PATH_INFO $fastcgi_path_info;
     include /etc/nginx/fastcgi_params;
     #fastcgi_index Default.asmx;

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


From looking at the Mono Docs for NGINX, they recommend a slightly different configuration.

 server {
         listen   80;
         access_log   /var/log/nginx/;
         root /var/www/;

         location / {
                 index index.html index.htm default.aspx Default.aspx;
                 fastcgi_index Default.aspx;
                 include /etc/nginx/fastcgi_params;


fastcgi_param  PATH_INFO          "";
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

… being added to fastcgi_params, or replacing what is already there if those are already set to values other than the above.

The default location of fastcgi_params on Ubuntu is normally /etc/nginx/fastcgi_params unless you have modified it and placed it elsewhere or installed a version of NGINX that isn’t in their repos.

You can further modify the above server block and add error_log to create a log specifically for that block as well. You’d add:

error_log /var/log/nginx/;

… below or above access_log. Once changes are made, you’d want to reload or restart NGINX.

service nginx reload
service nginx restart


systemctl reload nginx
systemctl restart nginx