Update 2025-04-13_16:21:50
This commit is contained in:
28
listen_change.sh
Executable file
28
listen_change.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# Script Version: 01
|
||||
# Description: Replaces 'listen 443 ssl' with 'listen 80' in Nginx configuration files under /etc/nginx/sites-enabled/
|
||||
|
||||
# Directory containing Nginx site configurations
|
||||
CONFIG_DIR="/etc/nginx/sites-enabled"
|
||||
|
||||
# Iterate over each file in the configuration directory
|
||||
for FILE in "$CONFIG_DIR"/*; do
|
||||
# Check if the file is a regular file
|
||||
if [ -f "$FILE" ]; then
|
||||
# Replace 'listen 443 ssl' with 'listen 80'
|
||||
sed -i 's/listen 443 ssl;/listen 80;/g' "$FILE"
|
||||
fi
|
||||
done
|
||||
|
||||
# Test Nginx configuration
|
||||
nginx -t
|
||||
|
||||
# Check if the configuration test was successful
|
||||
if [ $? -eq 0 ]; then
|
||||
# Reload Nginx to apply changes
|
||||
systemctl reload nginx
|
||||
echo "Nginx reloaded successfully."
|
||||
else
|
||||
echo "Nginx configuration test failed. Please check the configuration files."
|
||||
fi
|
||||
|
Reference in New Issue
Block a user