我已经在 Linux 服务器上安装了 mono 平台,并且能够在 nginx HTTP 服务器后面运行它。该系统运行良好,可以完美地服务 .NET 特定的动态文件。
但是,我只想将所需的文件(通过扩展名)传递给 mono,并让 nginx 处理所有其他文件,包括静态文件和 .NET 平台上正常情况下不应提供的文件。我已经配置了我的 nginx,如下所示,但是 - 由于我对 .NET 平台没有足够的了解 - 我不确定哪些扩展 应该 必须传递给 mono,哪些扩展必须被禁止。
这是我的 nginx 配置文件的相关部分:
# Do not pass .NET forbidden extensions to anywhere.
# Theese are the extensions that should not be served to the clients
location ~ \.(config|dbml|dll|master|other|forbidden|exts)$ {
deny all;
}
这是将所需(仅需要)文件传递给 mono 的配置部分:
# Theese are the extensions which *must* be handled by mono
location ~ \.(aspx|cs|other|exts|that|must|be|handled|by|mono)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
fastcgi_index default.aspx;
}
# Other static files will be handled by nginx.
我从 维基百科条目,但它们还远未完成。
所以我的问题包含三个子问题:
- .NET 平台特定的文件扩展名是什么?
- 其中哪些必须由.NET 引擎处理?
- 其中哪些属于机密且不得送达客户?
这将是一个共享托管环境,因此任何缺少的扩展都可能会给用户带来不良影响(例如泄露用户密码或应用程序设置)。
I have installed mono platform on my Linux server and I was able to run it behind nginx HTTP server. The system is working well and serving .NET specific dynamic files flawlessly.
However, I want to pass only (and only) required files (by extension) to mono and let nginx handle all the other files including static files and the files that should not be served in normal circumstances on .NET platform. I have configured my nginx as seen below but - since I don't have enough knowledge about .NET platform - I am not sure which extensions should must be passed to mono and which ones must be forbidden.
Here is the related part of my nginx configuration file:
# Do not pass .NET forbidden extensions to anywhere.
# Theese are the extensions that should not be served to the clients
location ~ \.(config|dbml|dll|master|other|forbidden|exts)$ {
deny all;
}
And here is the configuration part that will pass required (only required) files to mono:
# Theese are the extensions which *must* be handled by mono
location ~ \.(aspx|cs|other|exts|that|must|be|handled|by|mono)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
fastcgi_index default.aspx;
}
# Other static files will be handled by nginx.
I have found some .NET specific file extensions from Wikipedia entry but they are far from complete.
So my question has three sub-questions:
- What are the .NET platform-specific file extensions?
- Which of them must be handled by .NET engine?
- Which of them confidential and must not be served to the clients?
This will be a shared hosting environment so any missing extension may result undesirable effects to user (eg. Revealed user passwords or application settings).
发布评论
评论(1)
最容易查看的地方可能是主 web.config 文件,它是声明 ASP.NET 基本设置的地方。这包括
,例如:Probably the easiest place to look is the master web.config file, which is where base settings for ASP.NET are declared. This includes
<httpHandlers>
, e.g.: