Is it possible to make part of a site on IIS only viewable from localhost?

前端 未结 10 818
后悔当初
后悔当初 2020-12-15 05:19

We\'ve got a webserver running IIS. We\'d like to run maybe a shared blog or something to keep track of information. Because of security issues, we\'d like for that part to

10条回答
  •  清歌不尽
    2020-12-15 05:32

    As suggested in https://stackoverflow.com/a/39870955/2279059, it is possible to configure the site's bindings to listen only on the loopback interface. This makes the site inaccessible from the network without having to use IP address restrictions.

    To support both IPv4 and IPv6, add two bindings, one for 127.0.0.1 and one for [::1], and set the hostname to *, so either IP address or localhost can be used to access it as shown in the screenshot:

    To add a "local" site programmatically, you can use:

    appcmd add site /name:MyLoalSite /bindings:http/127.0.0.1:7103:*,http/[::1]:7103:* /physicalPath:"C:\path\to\site\"
    

提交回复
热议问题