diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-10-10 13:46:00 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-10-10 13:46:00 -0400 |
| commit | 1b2a63f7fda4411adc71da3f43b173ffe7e7eb10 (patch) | |
| tree | 7ee1b0f6ae8e42869afbed34374c939c7a245c94 /src/Propellor/Property/Apache.hs | |
| parent | b3a5cb70dc04843a5b841f987bd60b8689edb58b (diff) | |
propellor spin
Diffstat (limited to 'src/Propellor/Property/Apache.hs')
| -rw-r--r-- | src/Propellor/Property/Apache.hs | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/Propellor/Property/Apache.hs b/src/Propellor/Property/Apache.hs index 49e3d525..b4bbdc32 100644 --- a/src/Propellor/Property/Apache.hs +++ b/src/Propellor/Property/Apache.hs @@ -5,7 +5,14 @@ import qualified Propellor.Property.File as File import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Service as Service -type ConfigFile = [String] +installed :: Property NoInfo +installed = Apt.installed ["apache2"] + +restarted :: Property NoInfo +restarted = Service.restarted "apache2" + +reloaded :: Property NoInfo +reloaded = Service.reloaded "apache2" -- | A basic virtual host, publishing a directory, and logging to -- the combined apache log file. @@ -21,6 +28,8 @@ virtualHost hn (Port p) docroot = siteEnabled hn , "</VirtualHost>" ] +type ConfigFile = [String] + siteEnabled :: HostName -> ConfigFile -> RevertableProperty siteEnabled hn cf = enable <!> disable where @@ -65,6 +74,16 @@ modEnabled modname = enable <!> disable `onChange` reloaded isenabled = boolSystem "a2query" [Param "-q", Param "-m", Param modname] +-- | Make apache listen on the specified ports. +-- +-- Note that ports are also specified inside a site's config file, +-- so that also needs to be changed. +listenPorts :: [Port] -> Property NoInfo +listenPorts ps = "/etc/apache2/ports.conf" `File.hasContent` map portline ps + `onChange` restarted + where + portline (Port n) = "Listen " ++ show n + -- This is a list of config files because different versions of apache -- use different filenames. Propellor simply writes them all. siteCfg :: HostName -> [FilePath] @@ -75,15 +94,6 @@ siteCfg hn = , "/etc/apache2/sites-available/" ++ hn ++ ".conf" ] -installed :: Property NoInfo -installed = Apt.installed ["apache2"] - -restarted :: Property NoInfo -restarted = Service.restarted "apache2" - -reloaded :: Property NoInfo -reloaded = Service.reloaded "apache2" - -- | Configure apache to use SNI to differentiate between -- https hosts. -- |
