toolkit/func/core/pkg_httpd/40-test-basic-vhost.sh

31 lines
765 B
Bash
Raw Normal View History

2021-07-05 06:50:25 +00:00
#!/bin/bash
2023-11-29 21:09:12 +00:00
function cleanup() {
rm /etc/httpd/conf.d/vhost.conf
sed -i '/127.0.0.1 coretest/d' /etc/hosts
m_serviceCycler httpd reload
}
2021-07-05 06:50:25 +00:00
r_log "httpd" "Test basic vhost functionality"
2023-11-29 21:09:12 +00:00
trap cleanup EXIT
2021-07-05 06:50:25 +00:00
echo "127.0.0.1 coretest" >> /etc/hosts
cat > /etc/httpd/conf.d/vhost.conf << EOF
## Core vhost test
NameVirtualHost *:80
<VirtualHost *:80>
ServerName coretest
ServerAdmin root@localhost
DocumentRoot /var/www/vhost/coretest
</VirtualHost>
EOF
mkdir -p /var/www/vhost/coretest
echo "core vhost test page" > /var/www/vhost/coretest/index.html
# This isn't normally needed, it should just work
restorecon -R /var/www/vhost
2021-07-05 06:50:25 +00:00
m_serviceCycler httpd cycle
curl -s http://coretest/ | grep -q 'core vhost test page' > /dev/null 2>&1
r_checkExitStatus $?