ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Virtual Hosts for Apache Using SaltState

    IT Discussion
    salt saltstack lamp linux apache state file state machine
    1
    1
    929
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      If you have build a LAMP stack with Salt, you will most likely want to actually deploy some websites to it! It only stands to reason. This is very simple and just requires that we make some Virtual Host configuration files.

      A Virtual Host file can be this simple /srv/salt/lamp_server1/files/test.conf:

      <VirtualHost *:80>
          DocumentRoot "/var/www/html/test"
          ServerName test.mydomain.com
          ErrorLog "/var/log/httpd/test_error_log"
          CustomLog "/var/log/httpd/test_access_log" common
      </VirtualHost>
      

      Then we just need a state file to use this. We will want something specific to a server or cluster:

      **/srv/salt/lamp_server1/init.sls

      /etc/httpd/conf.d/test.conf:
        file.managed:
          - source:
            - salt://lamp_server1/files/test.conf
          - user: root
          - group: root
          - mode: 644
      

      That's it. A very simple file. You can repeat these patterns for many websites on one server. For each site you can make an individual configuration file. Then add each configuration file into the init.sls state file.

      1 Reply Last reply Reply Quote 2
      • 1 / 1
      • First post
        Last post