Book Image

Salt Cookbook

By : Anirban Saha
Book Image

Salt Cookbook

By: Anirban Saha

Overview of this book

Table of Contents (18 chapters)
Salt Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Adding web server configuration


One of the most important tasks of Apache web server management is to make sure that the proper configuration file for the website or the application is in place. In this recipe, we will learn how to configure this file with a lot of details and parameters using Salt.

How to do it...

We will use the same minion as in the previous recipe.

  1. Edit /opt/salt-cookbook/development/apache/init.sls to have the following entries:

    apache_packages:
      pkg.installed:
        - pkgs:
          - apache2
    
    enable_rewrite_module:
      apache_module.enable:
        - name: rewrite
        - require:
          - pkg: apache_packages
    
    /etc/apache2/sites-enabled/salt-cookbook.conf:
      apache.configfile:
        - config:
          - VirtualHost:
              this: '*:80'
              ServerName:
                - salt-cookbook.com
              ServerAlias:
                - www.salt-cookbook.com
              ErrorLog: /var/log/apache2/salt-cookbook.com- error_log
              CustomLog: /var/log/apache2/salt-cookbook.com- access_log combined...