我无法使用IIS和IISNode从Windows Server 2012外部访问我的网站 [英] I can't access my website from outside Windows Server 2012 using IIS and IISNode

查看:162
本文介绍了我无法使用IIS和IISNode从Windows Server 2012外部访问我的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我购买了新的专用服务器.我有一个MEAN Stack应用程序(Node.js,Angular,MongoDB,Express),并想利用IIS来发布我的Web应用程序.

I bought a new dedicated server. I have a MEAN Stack application (Node.js, Angular, MongoDB, Express) and wanted to take advantage of using IIS to publish my webapp.

我遵循了本指南,以安装iisnode并使litle node.js服务器正常工作.

I followed this guide to install iisnode and make a litle node.js server working.

我做到了,并在服务器内部的浏览器中成功尝试了 http://iisnode.local .

I did it and succesfully tried http://iisnode.local in my browser inside the server.

另一方面,如果我尝试 http://(theIPoftheserver)/iisnode.local 我收到以下错误:

Ont he other hand, if I try http://(theIPoftheserver)/iisnode.local am I am getting the following error:

我需要做一些事情以使服务器可以从外部访问,但是我不知道该怎么办.

I need to do something for the server to be accesible from outside but I don't know what..

如果我转到 http://(theIPoftheserver)/,即使我去了,我也可以看到IIS网站到 http://(theIPoftheserver)/node 我可以看到iisnode网站...

If i go to http://(theIPoftheserver)/ I can see IIS website and even if I go to http://(theIPoftheserver)/node I can see the iisnode website...

我是新手,我需要一些帮助...

I am quite newbie and I need some help...

我的web.config文件:

My web.config file:

<configuration>
    <system.webServer>

        <!-- indicates that the server.js file is a node.js application
        to be handled by the iisnode module -->

        <handlers>
            <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
        </handlers>


        <rewrite>
            <rules>
                <rule name="sendToNode">
                    <match url="/*" />
                    <action type="Rewrite" url="server.js" />
                </rule>
            </rules>
        </rewrite>

        <iisnode enableXFF="true" />

    </system.webServer>
</configuration>

我还必须提到Windows的hosts文件中有一个新规则,如下所示:

I also have to mention that I have a new rule in windows' hosts file as follows:

127.0.0.1   iisnode.local

Windows防火墙可以阻止某些内容吗?我需要断开连接吗?

can windows firewall be blocking something? Do I need to disconnect it?

重要编辑14.09.2016:如果我编辑主机文件并添加:

IMPORTANT EDIT 14.09.2016: if I edit hosts file and add:

<server-ip-address> iisnode.local

然后我访问 http://iisnode.local ,它起作用了! 我不十分清楚为什么...我不希望我网站的所有用户都修改其主机文件,我该怎么办?

And then I the I visit http://iisnode.local it works! I don't understand it very well why though.. i don't want all the users of my website to modify their hosts file, what can I do?

我不知道这可能是问题的根源吗?

I don't know is this could be the source of the problem?

我的网站绑定看起来像这样:

My Website bindings look like this:

推荐答案

使用以下命令访问服务器内的站点

When you access your site within the server with

http://iisnode.local (按主机名)

http://127.0.0.1/(通过IP)

因此,当您使用IP地址时,请不要在iisnode.local之后放置

So when you use IP address, you don't put iisnode.local after it.

iisnode.local是主机名,在URL中,您可以同时使用主机名或IP.

iisnode.local is hostname, in an URL, you either use hostname OR IP, not the same time.

http://(服务器的IP)/iisnode.local

等于

http://(IP)/(hostname)< ---错了!

http://(IP)/(hostname) <--- That is wrong!

当前,我假设您没有服务器的公共DNS设置,正确的访问网站的方法将是

Currently, I am assuming you don't have public dns setup for your server, the correct way to access the site will be

http://(外部IP)/<-之后没有iisnode.local.

http://(External-IP)/ <-- No iisnode.local after it.

这篇关于我无法使用IIS和IISNode从Windows Server 2012外部访问我的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆