web-setup.sh 532 B

12345678910111213141516
  1. #!/bin/bash
  2. # Install apache
  3. /usr/bin/apt-get -y install apache2
  4. cat > /var/www/html/index.html <<EOD
  5. <html><head><title>${HOSTNAME}</title></head><body><h1>${HOSTNAME}</h1>
  6. <p>This is the default web page for ${HOSTNAME}.</p>
  7. </body></html>
  8. EOD
  9. sed -i 's/80/8000/g' /etc/apache2/ports.conf
  10. sed -i 's/80/8000/g' /etc/apache2/sites-enabled/000-default.conf
  11. # Log the X-Forwarded-For
  12. perl -pi -e 's/^LogFormat "\%h (.* combined)$/LogFormat "%h %{X-Forwarded-For}i $1/' /etc/apache2/apache2.conf
  13. /usr/sbin/service apache2 restart