From 188948efd084f587225c4faf6224501300e4fd7d Mon Sep 17 00:00:00 2001 From: Athmane Madjoudj Date: Sat, 2 Jul 2011 11:59:25 +0100 Subject: - Initial commit --- httpd/0-install_httpd.sh | 8 ++++++++ httpd/httpd_basic_auth.sh | 22 ++++++++++++++++++++++ httpd/httpd_php.sh | 10 ++++++++++ httpd/httpd_servehtml.sh | 8 ++++++++ httpd/httpd_vhost.sh | 22 ++++++++++++++++++++++ httpd/runtests.sh | 17 +++++++++++++++++ 6 files changed, 87 insertions(+) create mode 100755 httpd/0-install_httpd.sh create mode 100755 httpd/httpd_basic_auth.sh create mode 100755 httpd/httpd_php.sh create mode 100755 httpd/httpd_servehtml.sh create mode 100755 httpd/httpd_vhost.sh create mode 100755 httpd/runtests.sh (limited to 'httpd') diff --git a/httpd/0-install_httpd.sh b/httpd/0-install_httpd.sh new file mode 100755 index 0000000..30266f0 --- /dev/null +++ b/httpd/0-install_httpd.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# A small Apache HTTPd test suite +# Author: Athmane Madjoudj + +# HTTPD / PHP +yum -y -d0 install httpd mod_ssl php php-mysql +chkconfig httpd on +service httpd start diff --git a/httpd/httpd_basic_auth.sh b/httpd/httpd_basic_auth.sh new file mode 100755 index 0000000..4e0090f --- /dev/null +++ b/httpd/httpd_basic_auth.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# A small Apache HTTPd test suite +# Author: Athmane Madjoudj + +echo "Running $0 - httpd basic authentication test." + +cat > /etc/httpd/conf.d/dir-test-basic-auth.conf < + AuthType Basic + AuthName "Test" + AuthUserFile /etc/httpd/htpasswd + require user test + +EOF + +htpasswd -c -b /etc/httpd/htpasswd test test +mkdir -p /var/www/html/basic_auth_test +echo "Basic authentication Test Page" > /var/www/html/basic_auth_test/index.html +service httpd reload +curl -s -u test:test http://localhost/basic_auth_test/ | grep 'Basic authentication Test Page' > /dev/null 2>&1 + diff --git a/httpd/httpd_php.sh b/httpd/httpd_php.sh new file mode 100755 index 0000000..12a3cb0 --- /dev/null +++ b/httpd/httpd_php.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# A small Apache HTTPd test suite +# Author: Athmane Madjoudj + +echo "" > /var/www/html/test.php + +echo "Running $0 - httpd handle PHP test" + +curl -s http://localhost/test.php | grep 'PHP Version' > /dev/null 2>&1 + diff --git a/httpd/httpd_servehtml.sh b/httpd/httpd_servehtml.sh new file mode 100755 index 0000000..8b0cb06 --- /dev/null +++ b/httpd/httpd_servehtml.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# A small Apache HTTPd test suite +# Author: Athmane Madjoudj + +echo "Running $0 - httpd serve html page test." + +curl -s http://localhost/ | grep 'Test Page' > /dev/null 2>&1 + diff --git a/httpd/httpd_vhost.sh b/httpd/httpd_vhost.sh new file mode 100755 index 0000000..2021e9f --- /dev/null +++ b/httpd/httpd_vhost.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# A small Apache HTTPd test suite +# Author: Athmane Madjoudj + +echo "Running $0 - httpd virtual host test." + +echo "127.0.0.1 test" >> /etc/hosts +cat > /etc/httpd/conf.d/vhost-test.conf < + ServerAdmin webmaster@test + DocumentRoot /var/www/vhosts/test/ + ServerName test + +EOF + +mkdir -p /var/www/vhosts/test/ +echo "Virtual Host Test Page" > /var/www/vhosts/test/index.html +service httpd reload +curl -s http://test/ | grep 'Virtual Host Test Page' > /dev/null 2>&1 + diff --git a/httpd/runtests.sh b/httpd/runtests.sh new file mode 100755 index 0000000..e3f4f4a --- /dev/null +++ b/httpd/runtests.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# A small Apache HTTPd test suite +# Author: Athmane Madjoudj + +# Install some required utilities +yum -y -d0 install curl grep + +# Run install +./0-install_httpd.sh + +# Run tests + +for testscript in httpd_* +do + ./$testscript + [ $? -eq 0 ] && echo "==> [ PASS ]" || echo "==> [ FAIL ]" +done -- cgit