Files
gentoo-pill/serve.sh
2025-12-07 16:53:33 +06:00

29 lines
782 B
Bash

#!/bin/sh
WEB_CONTAINER="gentoo_binhost_server"
WEB_PORT="8080"
echo "Checking Web Server..."
if ! podman container exists "$WEB_CONTAINER"; then
echo "Starting Nginx binhost server on port $WEB_PORT..."
podman run -d \
--name "$WEB_CONTAINER" \
--restart always \
-p "$WEB_PORT":80 \
-v binpkgs:/usr/share/nginx/html:ro \
nginx:alpine \
/bin/sh -c '
echo "server {
listen 80;
root /usr/share/nginx/html;
location / {
autoindex on;
}
}" > /etc/nginx/conf.d/default.conf && nginx -g "daemon off;"'
else
podman start "$WEB_CONTAINER" >/dev/null 2>&1
echo "Server is running at http://localhost:$WEB_PORT"
fi