Last active
March 19, 2026 05:21
-
-
Save tsabunkar/68070b9d7de92cf7b759e6bc91c52d84 to your computer and use it in GitHub Desktop.
User Data for Amazon Linux 2023 AMI - Spinup a httpd server and host a web page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Update packages | |
| dnf update -y | |
| # Install Apache | |
| dnf install -y httpd | |
| # Start and enable service | |
| systemctl start httpd | |
| systemctl enable httpd | |
| # Create web page | |
| echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html | |
| # Fix permissions (important for AL2023 sometimes) | |
| chmod 644 /var/www/html/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment