Created
April 21, 2024 13:49
-
-
Save overnew/86cf63b055e7d67146df2adbaf805137 to your computer and use it in GitHub Desktop.
web_userdata
This file contains 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 | |
# Nginx 설치 | |
apt update | |
apt install -y nginx | |
index_file="/var/www/html/index.html" | |
cat <<EOF > $index_file | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Welcome to Jin</title> | |
</head> | |
<body> | |
<h1>Welcome to WEB</h1> | |
<p>Hello, this is a simple webpage served by Nginx.</p> | |
<a href="/was">Go to was Page</a> | |
</body> | |
</html> | |
EOF | |
systemctl start nginx | |
# Nginx 설정 파일 열기 | |
nginx_config="/etc/nginx/sites-available/default" | |
# Nginx 프록시 설정 추가 | |
cat <<EOF > $nginx_config | |
server { | |
listen 80; | |
server_name babo; | |
location /was { | |
proxy_pass http://internal-3-tier-app-alb-2072048027.ap-northeast-2.elb.amazonaws.com/; | |
} | |
} | |
EOF | |
# 설정 적용 및 Nginx 재시작 | |
ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default | |
nginx -t && systemctl reload nginx | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment