Search code examples
iisdeploymentvirtual-directory

How to publish a virtual directory over IIS or XAMPP?


I have a virtual directory that points to a virtual drive on sql server. I need this directory to be accessible over the Internet, how do I do that? I've tried adding a virtual directory to default IIS website enter image description here When navigating over to localhost/magentofiles this is what I get. enter image description here

Of course it cannot find web.config...it's a directory not a project I'm trying to publish. Any help is much appreciated.


Solution

  • Since it didn't really matter whether to use IIS or XAMPP, I went with XAMPP because I could not solve the errors of IIS. Now here's how to publish a directory over xampp.

    • Create a directory in xampp/htdocs (let's say "files")
    • In cmd go to that new directory.
    • use mklink to create a symbolic link to your desired destination (let's say "images")

    open up xampp\apache\conf\extra\httpd-vhosts.conf and at the bottom of the file append this code

    <VirtualHost *:80>
        DocumentRoot "C:\xampp\htdocs\files"
    
        <Directory "C:\xampp\htdocs\files">
            Options FollowSymLinks Includes ExecCGI
            Require all granted
        </Directory>
    
    </VirtualHost>
    
    • Restart apache

    You should be able to access files in that directory over localhost/images/example.png

    Also note that the user, which xampp runs by should have access to the destination that you are publishing, otherwise you will get 403 Access forbidden.