#!/bin/sh # Default web directory for Apache WEB_DIR="/usr/local/apache2/htdocs" echo "Starting web server initialization..." # Check if web directory exists, create if it doesn't if [ ! -d "$WEB_DIR" ]; then echo "Creating web directory: $WEB_DIR" mkdir -p "$WEB_DIR" fi # Check if web directory is empty (no files or only hidden files) if [ -z "$(ls -A "$WEB_DIR" 2>/dev/null | grep -v '^\.')" ]; then echo "Web directory is empty. Copying default landing page..." cp /index.html "$WEB_DIR/" echo "Default landing page copied successfully." else echo "Web directory contains files. Skipping default page copy." fi echo "Starting Apache web server..." echo "Server will be available at: http://localhost:80" # Start Apache in foreground exec httpd-foreground