Hi All,
I have a requirement to remove one domian name from serveralias configuration from one specific environment.
We are using 4 domain names for serverAlias configuration in vhost , but in one of the domain name is matching the stage/prod domain url then i have to remove the particular domain name from serverAlias configuration.
I tried with something like this, but it's not working.
<If "${DomainA}=='stage.domain.com'">
ServerAlias ${DomainB} ${DomaiC} ${DomainD}
</If>
<Else>
ServerAlias ${DomainA} ${DomainB} ${DomaiC} ${DomainD}
</Else>
Could any of you please suggest how to implement this requirement.
Thanks
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @prashanth55 ,
If you need to provide a different configuration for an environment try the following configuration.
customs.vars:
Define SERVER_ALIASES "${DomainA} ${DomainB} ${DomaiC} ${DomainD}"
<IfDefine ENVIRONMENT_STAGE>
Define SERVER_ALIASES "${DomainB} ${DomaiC} ${DomainD}"
</IfDefine>
vhost configuration:
ServerAlias ${SERVER_ALIASES}
Best regards,
Kostiantyn Diachenko.
Hi @prashanth55 ,
If you need to provide a different configuration for an environment try the following configuration.
customs.vars:
Define SERVER_ALIASES "${DomainA} ${DomainB} ${DomaiC} ${DomainD}"
<IfDefine ENVIRONMENT_STAGE>
Define SERVER_ALIASES "${DomainB} ${DomaiC} ${DomainD}"
</IfDefine>
vhost configuration:
ServerAlias ${SERVER_ALIASES}
Best regards,
Kostiantyn Diachenko.
Hello @prashanth55,
Not sure if it's too late to answer.
But not sure how wise it would be to write logic in vhost config, rather you can do the following:
- Create environment specific (dev2, dev, stage, prod) .vars files as follow:
/etc/httpd/conf.d/variables/domains_${ENV_TYPE}.vars
//contains the following when: ENV_TYPE=dev2 or dev or prod
Define DOMAINS "domain_a domain_b domain_c domain_d"
//contains the following when: ENV_TYPE=stage
Define DOMAINS "domain_b domain_c domain_d"
- Add the .vars file in the vhost as follow (on top of the file):
Include /etc/httpd/conf.d/variables/domains_${ENV_TYPE}.vars
- Add the ServerAlias in the vhost file as as follow:
ServerAlias ${DOMAINS}
Points to note here is that: for AMS the ENV_TYPE variable needs to be configured in /etc/sysconfig/httpd file in the dispatcher server and for Cloud it needs to be configured via environment variable using cloud manager.
Thanks!