File structure for nearly identical sites

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

File structure for nearly identical sites

Darryl Philip Baker

I am getting a set of over 50 sites moved over to my server from elsewhere and the content manager want to duplicate each of these in a dev subdomain. An example eatatjoes.example.com and eatatjoes.dev.example.com. I am thinking that I can include the same configuration file twice if I replace the “dev.” with a macro. The first time in include the file the macro has the value of “.” And the second time the value of the macro is “dev.” I would do something similar for the document directory.

 

Is there a way of keeping some directives from being in the live configuration for just the second time I include the file?

 

In my case there are likely to be redirects as they test a site prior to a relaunch. They like to keep bookmarks working even after restructuring a site.

 

Darryl Baker, GSEC  (he/him/his)

Sr. System Administrator

Distributed Application Platform Services

Northwestern University

1800 Sherman Ave.

Suite 6-600 – Box #39

Evanston, IL  60201-3715

[hidden email]

(847) 467-6674

 

Reply | Threaded
Open this post in threaded view
|

Re: File structure for nearly identical sites

Yehuda Katz
Your best option to do that might be to add a separate file with that config and call it with IncludeOptional

For example:
<Macro VHost $name $domain>
<VirtualHost *:80>
    ServerName $domain
    ServerAlias www.$domain

    DocumentRoot "/var/www/vhosts/$name"
    ErrorLog "/var/log/httpd/$name.error_log"
    CustomLog "/var/log/httpd/$name.access_log" combined
    
    IncludeOptional "/var/www/config/$name.conf"
</VirtualHost>
</Macro>

You can then add the different config to those files.

- Y

On Thu, Jul 9, 2020 at 4:25 PM Darryl Philip Baker <[hidden email]> wrote:

I am getting a set of over 50 sites moved over to my server from elsewhere and the content manager want to duplicate each of these in a dev subdomain. An example eatatjoes.example.com and eatatjoes.dev.example.com. I am thinking that I can include the same configuration file twice if I replace the “dev.” with a macro. The first time in include the file the macro has the value of “.” And the second time the value of the macro is “dev.” I would do something similar for the document directory.

 

Is there a way of keeping some directives from being in the live configuration for just the second time I include the file?

 

In my case there are likely to be redirects as they test a site prior to a relaunch. They like to keep bookmarks working even after restructuring a site.

 

Darryl Baker, GSEC  (he/him/his)

Sr. System Administrator

Distributed Application Platform Services

Northwestern University

1800 Sherman Ave.

Suite 6-600 – Box #39

Evanston, IL  60201-3715

[hidden email]

(847) 467-6674