如何使用appcmd.exe为HTTPS添加新的绑定 [英] How to use appcmd.exe to add a new binding for HTTPS

查看:123
本文介绍了如何使用appcmd.exe为HTTPS添加新的绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下脚本来设置我的网站...

I have the following script that sets up my website...

%AppCmd% ADD SITE /name:%SiteName% /physicalPath:%SitePath% /bindings:http/*:80:%SiteName%
%AppCmd% SET SITE /site.name:%SiteName% /[path='/'].applicationPool:%SiteName%

我现在想做的是找出如何为HTTPS添加附加绑定.看到了很多页面,这些页面现在描述了如何将主机标头添加到现有的https绑定中,但是却没有一个页面能够像在UI中一样实际显示如何添加新绑定.

What I would like to do now is to find out how to add an additional binding for HTTPS. Seen plenty of pages describing now to add a host header to an existing https binding but none that show actually how to add a new binding as you can do in the UI.

注意:我相信我需要两个绑定,一个HTTP(端口80)和一个HTTPS(端口443),因为目前我需要打开端口80,因为我使用重定向规则将在端口80上访问站点的人交换到443上.如果有办法,我可以避免这样做,而只需绑定就可以了.

Note: I believe I need two bindings, one HTTP (port 80) and one HTTPS (port 443) as at present I need to have port 80 open as I use a redirect rule to swap people that hit the site on port 80 over onto 443. If there is a way I can avoid doing this and simply my bindings I'm all for it.

推荐答案

您可以为http或https添加多个绑定.

You can add multiple bindings for http or https.

打开命令行并设置路径

cd %windir%\system32\inetsrv

添加第一个绑定

appcmd set site "mysite.domain.com.tr" /bindings:"https://mysite.domain.com.tr:443"

添加其他绑定

appcmd set site /site.name:mysite.domain.com.tr /+bindings.[protocol='https',bindingInformation='*:443:mysite1.domain.com.tr']
appcmd set site /site.name:mysite.domain.com.tr /+bindings.[protocol='https',bindingInformation='*:443:mysite1.domain.com.tr']
appcmd set site /site.name:mysite.domain.com.tr /+bindings.[protocol='https',bindingInformation='*:443:mysite1.domain.com.tr']

您可以将网站配置文件导出为xml

And you can export web site config file as xml

%windir%\system32\inetsrv\appcmd list site "mysite.domain.com.tr" /config /xml > "C:\Users\Administrator\Desktop\backup\mysite.domain.com.tr.xml"

这篇关于如何使用appcmd.exe为HTTPS添加新的绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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