diff --git a/README.docker.md b/README.docker.md index 78266c3..e910ae8 100644 --- a/README.docker.md +++ b/README.docker.md @@ -16,7 +16,7 @@ This guide explains how to build and deploy the SessionZero Blazor WebAssembly P docker-compose up -d --build ``` -3. Access the application at http://localhost:8080 +3. Access the application at http://localhost:80 ## Building and Running with Docker CLI @@ -30,10 +30,10 @@ This guide explains how to build and deploy the SessionZero Blazor WebAssembly P 3. Run the container: ```bash - docker run -d -p 8080:80 --name sessionzero-app sessionzero + docker run -d -p 80:80 --name sessionzero-app sessionzero ``` -4. Access the application at http://localhost:8080 +4. Access the application at http://localhost:80 ## Stopping the Container @@ -58,7 +58,7 @@ docker rm sessionzero-app docker logs sessionzero-app ``` -- Make sure ports 8080 is not being used by another application on your host machine. +- Make sure port 80 is not being used by another application on your host machine. Note that port 80 often requires administrative privileges on most operating systems since it's a privileged port. - If the application doesn't work as expected, verify that all files were copied correctly by inspecting the container: diff --git a/docker-compose.yml b/docker-compose.yml index cf21678..f3bc667 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,10 +6,13 @@ services: context: . dockerfile: Dockerfile ports: - - "8080:80" # Map container port 80 to host port 8080 + - "80:80" # Map container port 80 to host port 80 restart: unless-stopped volumes: - nginx-cache:/var/cache/nginx + environment: + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_URLS=http://+:80 volumes: nginx-cache: diff --git a/nginx.conf b/nginx.conf index 4eaf78f..2fde321 100644 --- a/nginx.conf +++ b/nginx.conf @@ -13,12 +13,15 @@ http { server { listen 80; - server_name localhost; + server_name _; # Accept any server name root /usr/share/nginx/html; index index.html; location / { try_files $uri $uri/ /index.html =404; + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; } # Enable compression diff --git a/run-remote.sh b/run-remote.sh new file mode 100644 index 0000000..f7faf06 --- /dev/null +++ b/run-remote.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# This script helps test domain connectivity for SessionZero + +echo "=== SessionZero Domain Connectivity Test ===" +echo "" + +# Check if docker is running +if ! docker info > /dev/null 2>&1; then + echo "Error: Docker is not running or not installed." + exit 1 +fi + +# Check if the container is running +if ! docker ps | grep -q sessionzero; then + echo "Warning: SessionZero container is not running." + echo "Starting container..." + docker-compose up -d +fi + +# Get the domain from user input +read -p "Enter your domain (without http/https): " DOMAIN + +echo "" +echo "Testing connectivity to $DOMAIN..." + +# Test basic HTTP connectivity +echo "HTTP connectivity test:" +curl -v http://$DOMAIN/ -o /dev/null 2>&1 | grep -E 'Connected|< HTTP' + +# Check DNS resolution +echo "" +echo "DNS resolution test:" +host $DOMAIN + +# Check if port 80 is open +echo "" +echo "Port 80 test:" +nc -zv $DOMAIN 80 2>&1 + +# Get server's public IP +echo "" +echo "Your server's public IP:" +curl -s ifconfig.me + +echo "" +echo "=== Test Complete ===" +echo "If all tests passed but the site still doesn't work, check your Nginx logs:" +echo "docker logs sessionzero-app"