Question

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 (http://unity3d.com)” “-”

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 127.0.0.1:9000; } }

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. https://pastebin.com/CJMH1GyB

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@nattawitta

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

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

         location / {
                 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;
         }
 }

With:

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.

http://www.mono-project.com/docs/web/fastcgi/nginx/

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/your.domain1.xyz.error.log;

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

service nginx reload
service nginx restart

or

systemctl reload nginx
systemctl restart nginx