一連の Rightscript を使用して、最初の Rightscale ServerTemplate と Deployment を作成しました。私が作成したスクリプトの 1 つは、Apache に仮想ホストを追加することでした。
#!/bin/bash -e
if [ $RS_DISTRO = ubuntu ]; then
export apache=apache2
export apache_extra_conf_dir=/etc/apache2/conf.d
elif [ $RS_DISTRO = centos ]; then
export apache=httpd
export apache_extra_conf_dir=/etc/httpd/conf.d
fi
server_name=$SERVER_NAME
echo "Adding virtual hosts to ${apache_extra_conf_dir}/vh-${server_name}.conf"
cat > $apache_extra_conf_dir/vh-${server_name}.conf <<EOF
NameVirtualHost $SITE_IP:$SITE_PORT
<VirtualHost $SITE_IP:$SITE_PORT>
ServerName $SERVER_NAME
ServerAlias $SITE_DOMAIN *.$SITE_DOMAIN
UseCanonicalName Off
ServerAdmin $ADMIN_EMAIL
DocumentRoot $APACHE_WWW_DIR
<Directory "$APACHE_WWW_DIR">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
EOF
service $apache restart
exit 0
私の質問は、ServerTemplate で同じ Rightscript を 2 回使用できますが、それぞれに異なる入力 (IP、ポート、www dir、およびサーバー名) を設定できますか? 例えば。
サーバーテンプレート:
Execute Rightscript vhost: *:80 /www-x/ x.com
Execute Rightscript vhost: *:80 /www-y/ y.com
または、同じスクリプトで両方の仮想ホストが定義されているこのサーバー展開専用の特別な Rightscript を作成する必要がありますか?
Execute Rightscript vhost: *:80 /www-x/ x.com | *:80 /www-y/ y.com