Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change apache config file value from bash script

I need an example of changing apache configuration values from bash script, so that i can have the same configuration by running the script across my servers instead of copying and pasting the whole config file. Just a starting point to let me figure how could be done.

I've spend the last 2 hours on google but i can't find any clue. Thanks!

like image 388
user3519262 Avatar asked Feb 13 '23 01:02

user3519262


1 Answers

You can use sed command for changing config file of apache for example

sed -i "s|\("^ServerRoot" * *\).*|\1/www/www1|" httpd.conf

sed -i "s|\("^Timeout" * *\).*|\1600|" httpd.conf
like image 100
Rahul R Dhobi Avatar answered Feb 16 '23 01:02

Rahul R Dhobi