Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Nginx Configuration for Mono Web Service

$
0
0
Hi Guys,

I have a web service written in C# using Mono. I'm running nginx v 1.4.6 on Ubuntu server v14.04. The service works perfectly using xsp4 (Mono's ASP.NET Web Server) but on nginx, it downloads the asmx file instead of running it. I'd rather host with nginx. Here's the configuration I'm currently using.

server {
listen 8443;
server_name www.myplace.com;

root /usr/share/nginx/html;
index index.html index.aspx Default.aspx;

ssl on;
ssl_certificate /etc/ssl/certs/www.myplace.crt;
ssl_certificate_key /etc/ssl/private/www.myplace.key;

ssl_session_timeout 5m;

ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;

access_log /var/log/nginx/www.myplace.access.log;
error_log /var/log/nginx/www.myplace.error.log info;
# Possible Error Levels: [debug | info | notice | warn | error | crit | alert | emerg];

location ~ \.asmx$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
#try_files $uri $uri/ =404;
}
}

And here's my fastcgi_params file:

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param PATH_INFO "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name ;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

fastcgi_param HTTPS $https if_not_empty;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;

When I try to access the service using nginx, it downloads the asmx file instead of executing it.

https://www.myplace.com:8443/myservice.asmx

Can anyone explain what I'm missing?

Thanks.....

Viewing all articles
Browse latest Browse all 4759

Trending Articles