早些时候,我写了一篇关于如何使用几个不同的程序将您的计算机变成 Windows 文件共享服务器的帖子。(how to turn your computer into a Windows file sharing server)如果您正在寻找一种与朋友或家人共享本地计算机上文件的快速方法,这是一种简单的方法。
但是,如果您希望使用IIS在 Windows 中设置您自己的 FTP 服务器(setup your own FTP server in Windows using) ,您可以这样做,但这需要更多的技术知识。当然,它还可以让您对共享和安全性进行更精细的控制,因此它更适合对计算机有一点了解的人(computer know-how)。另外,IIS是关于运行网站的,所以如果你想同时运行几个网站和一个FTP 服务器(FTP server),那么IIS是最好的选择。
还值得注意的是,不同版本的IIS随(IIS)Windows的每种风格一起提供,并且它们的功能集都略有不同。IIS 5.0随Windows 2000提供,5.1 随Windows XP Professional提供。IIS 6适用于Windows Server 2003和Windows XP Professional 64-bit。IIS 7是对(IIS 7)IIS的完全重写,包含在Windows Server 2008和Windows Vista中。
IIS 7.5与Windows 7一起发布,IIS 8与Windows 8一起发布,IIS 8.5与Windows 8.1一起发布。如果可能,最好使用IIS 7.5或更高版本,因为它们支持最多的功能并具有更好的性能。
(Setup and Configure)在IIS中设置和配置FTP 服务器(FTP Server)
您需要在Windows中设置自己的(Windows)FTP 服务器(FTP server)的第一件事是确保已安装 Internet信息服务(Information Services)( IIS )。请记住(Remember),IIS 仅随Windows的(Windows)Pro、Professional、Ultimate 或 Enterprise 版本(Ultimate or Enterprise versions)提供。
在Windows Vista和更早版本中,单击开始(Start)、控制面板(Control Panel)并转到Add/Remove Programs。然后单击Add/Remove Windows Components。对于Windows 7及更高版本,单击控制面板中的(Control Panel)程序和功能(Programs and Features),然后单击打开或关闭 Windows 功能(Turn Windows features on or off)。
在组件向导中,向下滚动直到您在列表中看到 IIS 并将其选中。不过,在单击Next之前,请确保单击Details,然后检查 File Transfer Protocol (FTP) Service。
对于Windows 7及更高版本,继续并单击Internet Information Services和FTP Server旁边的框。您还需要确保选中Web 管理工具(Web Management Tools)框,否则您以后将无法从管理工具中管理(Administrative Tools)IIS。对于FTP,您需要选中FTP Service框,否则您将无法选择创建FTP 服务器(FTP server)。
单击确定(OK),然后单击下一步(Next)。Windows将继续安装必要的IIS文件以及FTP 服务(FTP service)。此时可能会要求您插入Windows XP 或 Windows Vista 光盘(Windows XP or Windows Vista disc)。您不需要Windows 7或更高版本的光盘。
为 FTP 设置和配置 IIS
安装IIS后,您可能需要重新启动计算机。现在我们要继续打开IIS 配置(IIS configuration)面板来设置 FTP 服务器(FTP server)。所以去开始(Start),然后控制面板(Control Panel),然后点击管理工具(Administrative Tools)。您现在应该会看到Internet Information Services的图标。
当您第一次在Vista或更早版本中打开(Vista)IIS时,您只会在左侧菜单中看到您的(hand menu)计算机名称(computer name)。继续并单击计算机名称(computer name)旁边的+ 符号,您将看到几个选项,例如Web Sites、FTP Sites等。我们对FTP Sites感兴趣,因此也将其展开。您应该看到Default FTP Site,单击它。
单击默认FTP 站点(FTP site)后,您会注意到顶部有几个按钮,看起来像VCR按钮:播放(Play)、停止(Stop)和暂停(Pause)。如果“播放”按钮(Play button)显示为灰色,则表示FTP 服务器(FTP server)处于活动状态。您的FTP 服务器(FTP server)现已启动并运行!您实际上可以通过您的FTP 客户端(FTP client)软件连接到它。我使用 SmartFTP,但你可以使用任何你喜欢的东西。
对于Windows 7及更高版本,您将看到与IIS不同的外观。首先,没有播放按钮或(play button or anything)类似的东西。此外,您会在主屏幕(home screen)上看到一系列配置选项,用于身份验证、SSL设置、目录浏览(directory browsing)等。
要在此处启动FTP 服务器(FTP server),您必须右键单击站点(Sites),然后选择添加 FTP 站点(Add FTP Site)。
这将打开FTP 向导(FTP wizard),您首先为FTP 站点(FTP site)命名并选择文件的物理位置。
接下来,您必须配置绑定和SSL。绑定基本上是您希望FTP 站点(FTP site)使用的 IP 地址。如果您不打算(t plan)运行任何其他网站,可以将其保留为“全部未分配”。(All Unassigned)选中自动启动 FTP 站点(Start FTP site automatically)复选框并选择无 SSL(No SSL),除非您了解证书。
最后,您必须设置身份验证和授权(authentication and authorization)。您必须选择是否需要匿名(Anonymous)或基本身份验证( Basic authentication)或两者兼而有之。对于授权,您可以从 所有用户(All Users)、匿名(Anonymous)用户或特定用户中进行选择。
您实际上可以通过打开资源管理器并输入(Explorer and typing)ftp://localhost在本地访问FTP 服务器(FTP server)。如果一切正常,您应该会看到文件夹加载(folder load)没有错误。
如果你有一个FTP 程序(FTP program),你可以做同样的事情。打开FTP 客户端软件并输入(FTP client software and type)localhost作为(localhost)主机名,然后选择匿名(Anonymous)登录。连接(Connect),您现在应该会看到该文件夹。
好的,现在我们让网站启动并运行!现在,您将要共享的数据放在哪里?在IIS中,默认的FTP 站点(FTP site)实际上位于C:\Inetpub\ftproot中。您可以在那里转储数据,但是如果您已经有数据位于其他地方并且不想将其移动到 inetpub 怎么办?
在Windows 7及更高版本中,您可以通过向导选择所需的任何位置,但它仍然只有一个文件夹。如果要向FTP 站点(FTP site)添加更多文件夹,则必须添加虚拟目录。现在,只需打开ftproot 目录(ftproot directory)并将一些文件转储到其中。
现在刷新您的FTP 客户端(FTP client),您现在应该会看到列出的文件!因此,您现在在本地计算机上拥有一个启动并正在运行的FTP 服务器。(FTP server)那么如何从本地网络上的另一台计算机连接?
为此,您必须打开Windows 防火墙(Windows Firewall)以允许FTP连接到您的计算机;否则所有外部计算机将被阻止。您可以通过转到“开始(Start)”、“控制面板(Control Panel)”、单击“ Windows 防火墙(Windows Firewall )”,然后单击“高级(Advanced)”选项卡来执行此操作。
在“网络连接设置”(Network Connection Settings)部分下,确保在左侧列表中选中所有连接,然后单击“设置”(Settings)按钮。您现在可以根据您的计算机提供的服务打开计算机上的某些端口。由于我们托管我们自己的FTP 服务器(FTP server),因此我们要检查FTP 服务器( FTP Server)。
将出现一个小弹出窗口(popup window),其中包含您可以更改的一些设置,只需保持原样,然后单击确定。(OK. Click OK)在Windows 防火墙主窗口(Windows Firewall window)中再次单击“确定” 。
在Windows 7及更高版本中,打开防火墙端口(firewall port)的过程有所不同。从控制面板(Control Panel)打开Windows 防火墙(Windows Firewall),然后单击左侧的(hand side)高级设置(Advanced Settings)。然后单击Inbound Rules并向下滚动直到看到FTP Server (FTP Traffic-In),右键单击它并选择Enable Rule。
然后点击Outbound Rules并为(Outbound Rules)FTP Server (FTP Traffic-Out)做同样的事情。您现在已经为FTP(FTP)连接打开了防火墙。现在尝试从网络上的另一台计算机连接到您的FTP 站点(FTP site)。您需要先获取计算机的IP 地址(IP address),然后才能从另一台计算机连接到它。
转到开始(Start),单击运行(Run)并输入CMD。输入IPCONFIG并记下IP 地址(IP Address)的编号:
在另一台计算机上的FTP 客户端中,输入您刚刚记下的(FTP client)IP 地址(IP Address)并匿名连接。您现在应该能够像在本地计算机上的FTP 客户端上一样查看所有文件。(FTP client)同样(Again),您也可以转到资源管理器(Explorer)并输入FTP :\ipaddress 进行连接。
现在FTP 站点(FTP site)正在运行,您可以根据需要添加任意数量的文件夹以用于FTP目的。这样,当用户连接时,他们指定将连接到一个特定文件夹的路径。
回到IIS,右键单击Default FTP Site并选择New,然后选择Virtual Directory。
在Windows 7中,右键单击站点名称(site name)并选择添加虚拟目录(Add Virtual Directory)。
当您在IIS(IIS)中创建虚拟目录时,您基本上将创建一个指向本地硬盘驱动器上的文件夹的别名。因此,在向导中,您首先会被要求输入别名。Make是一些简单而有用的东西,例如“WordDocs”或“FreeMovies”等。
单击下一步(Click Next),现在浏览到您希望别名引用的路径。因此,如果您有一堆想要分享的电影,请浏览到该文件夹。
单击下一步(Click Next)并选择您是否希望它为只读(Read)访问权限或读写(Read and Write)访问权限。如果您只是想共享文件,请选中Read。如果您希望人们能够将文件上传到您的计算机,请选择读取和写入(Read and Write)。
单击下一步(Click Next),然后单击完成(Finish)!现在您将在默认FTP 站点(FTP site)下方看到您的新虚拟目录。在Windows 7及更高版本中,该过程简化为一个对话框,如下所示:
您可以通过在路径字段(Path field)“/Test”或“/NameOfFolder”中使用FTP 客户端(FTP client)连接到您。在Explorer中,您只需输入ftp://ipaddress/aliasname。
现在您只会看到我们为其创建别名的文件夹中的文件。
就是这样!您可以创建任意数量的文件夹!您需要做的唯一一件事就是将您的公共IP 地址(IP address)提供给从内部网络外部连接的任何人。如果您希望用户从世界任何地方进行连接,您必须向他们提供您的公共IP 地址(IP address),您可以通过访问http://whatismyipaddress.com/找到该地址。
最后,您需要将路由器上的FTP 端口转发到托管(FTP port)FTP 服务器(FTP server)的本地计算机。Port Forward是一个很棒的网站,可以向您展示如何将路由器上的端口转发到家庭网络(home network)上的计算机。您还应该阅读我关于端口转发(port forwarding)和动态DNS的其他帖子:
什么是端口转发?
为远程访问设置动态 DNS
这绝对是包含大量步骤的大量信息;如果您对所有这些有任何疑问,请发表评论!享受!
How to Setup an FTP Server in Windows using IIS
Earlіer, I had written a post on how to turn your computer into a Windows file sharing server using a couple of different programs. If you’re looking for a quick way to share the files on your local computer with friends or family, this is an easy way to do so.
However, if you’re looking to setup your own FTP server in Windows using IIS, you can do so, but it requires more technical knowledge. Of course, it also gives your more granular control over sharing and security, so it’s better for anyone who has a little computer know-how. Plus, IIS is all about running websites, so if you want to run a couple of websites along with an FTP server, then IIS is the best choice.
It’s also worth noting that different versions of IIS come with each flavor of Windows and they all have slightly different feature sets. IIS 5.0 came with Windows 2000 and 5.1 came with Windows XP Professional. IIS 6 was for Windows Server 2003 and Windows XP Professional 64-bit. IIS 7 was a complete rewrite of IIS and was included with Windows Server 2008 and Windows Vista.
IIS 7.5 was released along with Windows 7, IIS 8 released with Windows 8 and IIS 8.5 released with Windows 8.1. It’s best to use IIS 7.5 or higher if possible as they support the most features and have better performance.
Setup and Configure an FTP Server in IIS
The first thing you’ll need to setup your own FTP server in Windows is to make sure you have Internet Information Services (IIS) installed. Remember, IIS only comes with Pro, Professional, Ultimate or Enterprise versions of Windows.
In Windows Vista and earlier, click on Start, Control Panel and go to Add/Remove Programs. Then click on Add/Remove Windows Components. For Windows 7 and higher, click on Programs and Features from Control Panel and then click on Turn Windows features on or off.
In the components wizard, scroll down until you see IIS in the list and check it off. Before you click Next though, make sure you click on Details and then check File Transfer Protocol (FTP) Service.
For Windows 7 and up, go ahead and click on the box next to Internet Information Services and FTP Server. You also need to make sure you check the Web Management Tools box otherwise you won’t be able to manage IIS from Administrative Tools later on. For FTP, you need to check the FTP Service box otherwise you won’t have the option to create an FTP server.
Click OK and then click Next. Windows will go ahead and install the necessary IIS files along with the FTP service. You may be asked to insert your Windows XP or Windows Vista disc at this point. You shouldn’t need a disc for Windows 7 or higher.
Setup and configure IIS for FTP
Once IIS has been installed, you may have to restart your computer. Now we want to go ahead and open the IIS configuration panel to set up the FTP server. So go to Start, then Control Panel and click on Administrative Tools. You should now see an icon for Internet Information Services.
When you open IIS in Vista or earlier for the first time, you’ll only see your computer name in the left hand menu. Go ahead and click the + symbol next to the computer name and you’ll see a couple of options like Web Sites, FTP Sites, etc. We’re interested in FTP Sites, so expand that out also. You should see Default FTP Site, click on it.
You’ll notice after you click on the default FTP site that there are a couple of buttons at the top that look like VCR buttons: Play, Stop, and Pause. If the Play button is greyed out, that means the FTP server is active. Your FTP server is now up and running! You can actually connect to it via your FTP client software. I use SmartFTP, but you can use whatever you like best.
For Windows 7 and higher, you’ll see a different look to IIS. Firstly, there is no play button or anything like that. Also, you’ll see a bunch of configuration options right on the home screen for authentication, SSL settings, directory browsing, etc.
To start the FTP server here, you have to right-click on Sites and then choose Add FTP Site.
This opens the FTP wizard where you start by giving your FTP site a name and choosing the physical location for the files.
Next, you have to configure the bindings and SSL. Bindings are basically what IP addresses you want the FTP site to use. You can leave it at All Unassigned if you don’t plan on running any other website. Keep the Start FTP site automatically box checked and choose No SSL unless you understand certificates.
Lastly, you have to setup authentication and authorization. You have to choose whether you want Anonymous or Basic authentication or both. For authorization, you choose from All Users, Anonymous users or specific users.
You can actually access the FTP server locally by opening Explorer and typing in ftp://localhost. If all worked well, you should see the folder load with no errors.
If you have an FTP program, you can do the same thing. Open the FTP client software and type in localhost as the host name and choose Anonymous for the login. Connect and you should now see the folder.
Ok, so now we got the site up and running! Now where do you drop the data you want to share? In IIS, the default FTP site is actually located in C:\Inetpub\ftproot. You can dump data in there, but what if you already have data located somewhere else and don’t want to move it to inetpub?
In Windows 7 and higher, you can pick any location you want via the wizard, but it’s still only one folder. If you want to add more folders to the FTP site, you have to add virtual directories. For now, just open the ftproot directory and dump some files into it.
Now refresh your FTP client and you should now see your files listed! So you now have an up and running FTP server on your local computer. So how would you connect from another computer on the local network?
In order to do this, you’ll have to open up the Windows Firewall to allow FTP connections to your computer; otherwise all external computers will be blocked. You can do this by going to Start, Control Panel, clicking on Windows Firewall and then clicking on the Advanced Tab.
Under the Network Connection Settings section, make sure all of the connections are checked in the left list and then click on the Settings button. You’ll now be able to open certain ports on your computer based on the service your computer is providing. Since we are hosting our own FTP server, we want to check off FTP Server.
A little popup window will appear with some settings that you can change, just leave it as it is and click OK. Click OK again at the main Windows Firewall window.
In Windows 7 and higher, the process is different for opening the firewall port. Open Windows Firewall from the Control Panel and then click on Advanced Settings on the left hand side. Then click on Inbound Rules and scroll down till you see FTP Server (FTP Traffic-In), right click on it and choose Enable Rule.
Then click on Outbound Rules and do the same thing for FTP Server (FTP Traffic-Out). You have now opened up the firewall for FTP connections. Now try to connect to your FTP site from a different computer on your network. You’ll need to get the IP address of the computer first before you can connect into it from a different computer.
Go to Start, click Run and type in CMD. Type IPCONFIG and jot down the number for IP Address:
In your FTP client on the other computer, type in the IP Address you just wrote down and connect anonymously. You should now be able to see all of your files just like you did on the FTP client that was on the local computer. Again, you can also go to Explorer and just type in FTP:\\ipaddress to connect.
Now that the FTP site is working, you can add as many folders as you like for FTP purposes. In this way, when a user connects, they specify a path that will connect to one specific folder.
Back in IIS, right click on Default FTP Site and choose New, and then Virtual Directory.
In Windows 7, you right-click on the site name and choose Add Virtual Directory.
When you create a virtual directory in IIS, you’re basically going to create an alias that points to a folder on the local hard drive. So in the wizard, the first thing you’ll be asked is for a alias name. Make is something simple and useful like “WordDocs” or “FreeMovies”, etc.
Click Next and now browse to the path where you want the alias to refer to. So if you have a bunch of movies you want to share, browse to that folder.
Click Next and choose whether you want it as Read access only or Read and Write access. If you simply want to share files, check Read. If you want people to be able to upload files to your computer, choose Read and Write.
Click Next and then click Finish! Now you’ll see your new virtual directory below the default FTP site. In Windows 7 and up, the process is reduced to one dialog shown below:
You can connect to you using your FTP client by putting in the Path field “/Test” or “/NameOfFolder”. In Explorer, you would just type in ftp://ipaddress/aliasname.
Now you’ll only see the files that are in the folder that we created the alias for.
That’s about it! You can create as many folders as you like! The only thing other thing that you would need to do is to give out your public IP address to anyone who is connecting from outside of your internal network. If you want users to connect from anywhere in the world, you’ll have to give them your public IP address, which you can find out by going to http://whatismyipaddress.com/.
Finally, you’ll need to forward the FTP port on your router to your local computer that is hosting the FTP server. Port Forward is a great site to show you how to forward ports on your router to computers on your home network. You should also read my other posts on port forwarding and dynamic DNS:
What is Port Forwarding?
Setup Dynamic DNS for Remote Access
This is definitely a lot of info with a bunch of steps; if you have any questions about all of this, post a comment! Enjoy!