Has anyone ever tried to implement a web server? Or learn something about the possibility of a web server work program? I am wondering what happens exactly from the moment when the URL received by the web server to the file on the web server is found and sent back as an answer.
Does the server only support an internal table to remember the mapping between the supported URLs and the corresponding local paths? Or is there something more complicated?
Thank!
Update
Thank you for your responses. Here is my understanding at the moment.
I checked with Microsoft IIS (Internet Information Service), I noticed that IIS can host multiple sites, and the IEE IIS site remembers its root path in the local file system. Different sites on the same host have the same host name or IP, and they differ by individual ports. For instance:
http:
The web server will use part of the URL www.myServer.com:1111 to determine which path will be used on the local file system, and then in this local path it searches for the subfolder folder A, and then the page for the A..htm file.
The web server only needs to remember the following mapping between two lines:
"http://www.myServer.com:1111/" <---> "D:\myWebRoot"
I do not know where such mapping information is stored, perhaps some configuration files for the web server program in question.
, . .
- 2 -
, IIS , Host.config:
<sites>
<site name="Default Web Site" id="1" serverAutoStart="false">
<application path="/">
<virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:" />
<binding protocol="net.tcp" bindingInformation="808:*" />
<binding protocol="net.pipe" bindingInformation="*" />
<binding protocol="net.msmq" bindingInformation="localhost" />
<binding protocol="msmq.formatname" bindingInformation="localhost" />
</bindings>
</site>
<site name="myIISService" id="2" serverAutoStart="true">
<application path="/" applicationPool="myIISService">
<virtualDirectory path="/" physicalPath="D:\MySites\MyIISService" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:8022:" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%SystemDrive%\inetpub\logs\LogFiles" />
<traceFailedRequestsLogging directory="%SystemDrive%\inetpub\logs\FailedReqLogFiles" />
</siteDefaults>
<applicationDefaults applicationPool="DefaultAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
- 3 -
, foo, "" . WCF.
, , , , URL, . :
[http:
[net.tcp:
[net.msmq:
[net.pipe:
, URL-, URL- . , , , .