From 911156ad41686b1c09b4e7bf6914e45f9c778372 Mon Sep 17 00:00:00 2001 From: Tom-Inge Larsen Date: Tue, 1 Oct 2019 13:31:41 +0200 Subject: [PATCH 1/2] Changes described in #486 --- Examples/Sample_xWebsite_StopDefault.ps1 | 34 ++++++++++++++++++++++ README.md | 37 ------------------------ 2 files changed, 34 insertions(+), 37 deletions(-) create mode 100644 Examples/Sample_xWebsite_StopDefault.ps1 diff --git a/Examples/Sample_xWebsite_StopDefault.ps1 b/Examples/Sample_xWebsite_StopDefault.ps1 new file mode 100644 index 000000000..ac4f008ce --- /dev/null +++ b/Examples/Sample_xWebsite_StopDefault.ps1 @@ -0,0 +1,34 @@ +<# + .SYNOPSIS + When configuring a new IIS server, several references recommend removing or stopping the default website for security purposes. + This example sets up your IIS web server by installing IIS Windows Feature. + After that, it will stop the default website by setting `State = Stopped`. +#> +Configuration Sample_xWebsite_StopDefault +{ + param + ( + # Target nodes to apply the configuration + [string[]]$NodeName = 'localhost' + ) + # Import the module that defines custom resources + Import-DscResource -Module xWebAdministration + Node $NodeName + { + # Install the IIS role + WindowsFeature IIS + { + Ensure = "Present" + Name = "Web-Server" + } + # Stop the default website + xWebsite DefaultSite + { + Ensure = "Present" + Name = "Default Web Site" + State = "Stopped" + PhysicalPath = "C:\inetpub\wwwroot" + DependsOn = "[WindowsFeature]IIS" + } + } +} diff --git a/README.md b/README.md index d7399d8ee..509f07fde 100644 --- a/README.md +++ b/README.md @@ -498,43 +498,6 @@ xPhp -PackageFolder "C:\packages" ` -installMySqlExt $false ``` -## Stopping the default website - -When configuring a new IIS server, several references recommend removing or stopping the default website for security purposes. -This example sets up your IIS web server by installing IIS Windows Feature. -After that, it will stop the default website by setting `State = Stopped`. - -```powershell -Configuration Sample_xWebsite_StopDefault -{ - param - ( - # Target nodes to apply the configuration - [string[]]$NodeName = 'localhost' - ) - # Import the module that defines custom resources - Import-DscResource -Module xWebAdministration - Node $NodeName - { - # Install the IIS role - WindowsFeature IIS - { - Ensure = "Present" - Name = "Web-Server" - } - # Stop the default website - xWebsite DefaultSite - { - Ensure = "Present" - Name = "Default Web Site" - State = "Stopped" - PhysicalPath = "C:\inetpub\wwwroot" - DependsOn = "[WindowsFeature]IIS" - } - } -} -``` - ### Create a new website While setting up IIS and stopping the default website is interesting, it isn’t quite useful yet. From ff5d80d76f0daf663199887eb6e29a07de837be9 Mon Sep 17 00:00:00 2001 From: Tom-Inge Larsen Date: Tue, 1 Oct 2019 21:48:19 +0200 Subject: [PATCH 2/2] Example from #486 moved --- CHANGELOG.md | 2 ++ .../{ => Resources/xWebSite}/Sample_xWebsite_StopDefault.ps1 | 0 2 files changed, 2 insertions(+) rename Examples/{ => Resources/xWebSite}/Sample_xWebsite_StopDefault.ps1 (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 290bb21d7..dc9cd1993 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ - Changes to Examples - Created new folder structure for examples so that examples will be placed in `/Examples/Resources/$resourceName` ([issue #483](https://github.com/PowerShell/xWebAdministration/issues/483)) +- Moved examples out of Readme + - Moved examples from Readme.md to respective `/Examples/Resources/` folders. ([issue #486](https://github.com/PowerShell/xWebAdministration/issues/486)) ## 2.8.0.0 diff --git a/Examples/Sample_xWebsite_StopDefault.ps1 b/Examples/Resources/xWebSite/Sample_xWebsite_StopDefault.ps1 similarity index 100% rename from Examples/Sample_xWebsite_StopDefault.ps1 rename to Examples/Resources/xWebSite/Sample_xWebsite_StopDefault.ps1