Create vhost-file from mysql via shell script -


i create configuration script database. configuration stored as:

<virtualhost *:80>    servername example.com    proxyrequests off    proxypreservehost on    <proxy *>      require granted    </proxy>    proxypass / http://10.20.30.50:81/ retry=1 timeout=30    proxypassreverse / http://10.20.30.50:81/    <location />      require granted    </location>  </virtualhost>

apache gives me following error message:

apache2: syntax error on line 219 of /etc/apache2/apache2.conf: syntax error on line 1 of /etc/apache2/sites-enabled/example.com.conf: /etc/apache2/sites-enabled/example.com.conf:1: not closed.

my script likes:

sql="select domain, vhost v_create_proxy_vhost domain = 'example.com'"    while read vhost           echo "${vhost}"          printf "${vhost}" > "$vhostconfavailable/$domain.conf"    done < <(echo "$sql" |mysql -h $dbhost -u $dbuser -p$dbpassword --skip-column-names -s)

how can read , save configuration file? apache i've been using ubuntu 04.14, mysql , apache2.

  • the line number (219) on error suggests how trying append existing apache conf file, in case might able better serve getting @ entire conf file - point unclosed directive tag somewhere

    or

  • instead of appending existing conf file set vhosts, how setting individual conf files each vhost, reducing risk of modifying existing vhost directives ?


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -