I have a number of websites that run under IIS on a single machine.
Should I put these websites inside of the C:\inetpub\wwwroot\ folder or inside the C:\inetpub\ folder?
E.g.
or
Are there any pros/cons for either or another recommended location (I only have a C drive on this machine)?
I am not sure whether there is a "correct" answer to this, but want to follow best practice if there is one.
Many thanks, Jonathan
The wwwroot folder is new in ASP.NET 5 to store all of the static files in your project. Any files including HTML files, CSS files, image files, and JavaScript files which are sent to the user's browser should be stored inside this folder.
By default, the wwwroot folder in the ASP.NET Core project is treated as a web root folder. Static files can be stored in any folder under the web root and accessed with a relative path to that root.
New in ASP.NET Core projects is the existence of the wwwroot/lib folder, which holds collections of static files (CSS, JS, images) from front-end packages.
When the computer is not supposed to be used as a web server, you can delete Inetpub folder. Especially when this is causing some issues or you don't want to risk any of the vulnerabilities. This folder is useless and you can definitely delete it if you are not using the IIS or hosting websites on the computer.
Go the second route.
wwwroot is simply there as the container for the default website for the server. If you delete the default website from within IIS, then you can safely remove this directory. Regardless, your sites have nothing to do with the default, so they should be in their own folders under inetpub.
That said, we sometimes have multiple "types" of sites on the same server. For example DEV and QA. In this case I would structure it as:
c:\inetpub\dev\site1
c:\inetpub\dev\site2
c:\inetpub\qa\site1
c:\inetpub\qa\site2
As variant:
C:\WebSites\my.site1.com
C:\WebSites\my.site2.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With