-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx-setup.sh
More file actions
executable file
·67 lines (58 loc) · 1.97 KB
/
nginx-setup.sh
File metadata and controls
executable file
·67 lines (58 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
set -e
echo "Setting up Nginx configuration for Polly..."
# Create nginx directories if they don't exist
mkdir -p nginx/sites-available
mkdir -p nginx/sites-enabled
# Check if the site configuration exists
if [ ! -f "nginx/sites-available/polly.conf" ]; then
echo "Error: nginx/sites-available/polly.conf not found!"
echo "Please ensure the site configuration file exists."
exit 1
fi
# Create the symlink in sites-enabled (remove existing first)
if [ -L "nginx/sites-enabled/polly.conf" ]; then
echo "Removing existing symlink..."
unlink nginx/sites-enabled/polly.conf
fi
if [ -f "nginx/sites-enabled/polly.conf" ]; then
echo "Removing existing file (should be symlink)..."
rm nginx/sites-enabled/polly.conf
fi
echo "Creating symlink from sites-available to sites-enabled..."
cd nginx/sites-enabled
ln -s ../sites-available/polly.conf polly.conf
cd ../..
echo "Verifying nginx configuration structure..."
if [ -L "nginx/sites-enabled/polly.conf" ]; then
echo "✅ Symlink created successfully"
ls -la nginx/sites-enabled/polly.conf
else
echo "❌ Failed to create symlink"
exit 1
fi
# Test nginx configuration if nginx is available
if command -v nginx &> /dev/null; then
echo "Testing nginx configuration..."
nginx -t -c "$(pwd)/nginx/nginx.conf"
if [ $? -eq 0 ]; then
echo "✅ Nginx configuration is valid"
else
echo "❌ Nginx configuration has errors"
exit 1
fi
else
echo "⚠️ Nginx not installed locally, skipping configuration test"
echo "Configuration will be tested when Docker container starts"
fi
echo "✅ Nginx setup complete!"
echo ""
echo "Directory structure:"
echo "nginx/"
echo "├── nginx.conf (main configuration)"
echo "├── sites-available/"
echo "│ └── polly.conf (site configuration)"
echo "└── sites-enabled/"
echo " └── polly.conf -> ../sites-available/polly.conf (symlink)"
echo ""
echo "You can now run: docker-compose up --build -d"