If you're using a Windows computer, you already have everything you need to host a web site, and share files from your computer to anyone on the Internet, without installing anything. I couldn't find a simple guide for setting this up, hence this post.
Step 1: Enable the Internet Information Server feature.
The simplest way is to search for "Turn Windows features on or off", then click the Internet Information Services checkbox and click Ok.Step 2: Create a directory you want to share
For this example, we'll use a folder called shared_files in your Documents folder.
Step 3: Add the directory to your website
Upon enabling the IIS feature, Windows configures a single Default Site which serves files and subdirectories out of c:\inetpub\wwwroot. However, you can add Virtual Directories which are served out of other locations on your computer, which is how we'll make the folder you created available online.
Start by launching the Internet Information Services (IIS) Manager:
Then expand the tree on the left-hand side until you get to Default Web Site, then click Add Virtual Directory:
Type in what you want it to appear as on your website. Here, we've chosen files, so you can get to it at http://yourcomputer/files. Then, click the button next to Physical Path and choose the directory you want to share and click OK:
Next, click Connect As, then Specific user. Type in your username and password. This is needed because IIS does not run as your user on the machine, but instead as a separate sandboxed account for security purposes which doesn't have permission to access files you created. So, you'll have to give it that ability by telling it what user and password it should use for this folder.
Finally, IIS does not show the files in a directory by default, also for security reasons. (In other words, you need to know exactly the HTML file you want to browse.) To change this, open the tree on the left so it shows the new Virtual Directory you created, and click on it. Then double click on the Directory Browsing icon in the main view, and on the right, click Enable:Done
Finally, open up a web browser and navigate to your computer's IP address and directory you added, and you should see the list of files:
MIME Types
Finally, as a coda, you may find that IIS will give you an error when you click on certain files. If so, that's probably because you need to add that file type's extension to the list of MIME types IIS knows about. In the same place you clicked on Directory Browsing, double-click on MIME Types. Then, google for stackoverflow, the file extension you want to share, and the keywords mime type. You'll probably find the correct mime type, which you can add using that dialog.








No comments:
Post a Comment