@@ -364,12 +364,6 @@ enable_passwordless_sudo() {
364
364
install_nginx_and_php () {
365
365
clear
366
366
367
- # Check if firewalld is installed
368
- if ! command -v firewall-cmd & > /dev/null; then
369
- echo " Firewalld is not installed. Please install it before configuring firewall rules."
370
- return
371
- fi
372
-
373
367
# Check if NGINX is already installed
374
368
if dpkg -l | grep -q " nginx" ; then
375
369
echo " NGINX is already installed. Skipping NGINX installation."
@@ -400,25 +394,31 @@ install_nginx_and_php() {
400
394
echo " Firewall configuration"
401
395
echo " #######################################################"
402
396
403
- # Check if port 80 is open
404
- if ! sudo firewall-cmd --list-ports | grep -q " 80/tcp" ; then
405
- echo " Opening port 80 [TCP]..."
406
- sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
407
- else
408
- echo " Port 80 [TCP] is already open. Skipping."
409
- fi
397
+ # Check if firewalld is installed
398
+ if ! command -v firewall-cmd & > /dev/null; then
399
+ echo " Firewalld is not installed. Skipping."
410
400
411
- # Check if port 443 is open
412
- if ! sudo firewall-cmd --list-ports | grep -q " 443/tcp" ; then
413
- echo " Opening port 443 [TCP]..."
414
- sudo firewall-cmd --permanent --zone=public --add-port=443/tcp
415
401
else
416
- echo " Port 443 [TCP] is already open. Skipping."
417
- fi
402
+ # Check if port 80 is open
403
+ if ! sudo firewall-cmd --list-ports | grep -q " 80/tcp" ; then
404
+ echo " Opening port 80 [TCP]..."
405
+ sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
406
+ else
407
+ echo " Port 80 [TCP] is already open. Skipping."
408
+ fi
418
409
419
- echo " Reload configuration..."
420
- sudo firewall-cmd --reload
421
- echo
410
+ # Check if port 443 is open
411
+ if ! sudo firewall-cmd --list-ports | grep -q " 443/tcp" ; then
412
+ echo " Opening port 443 [TCP]..."
413
+ sudo firewall-cmd --permanent --zone=public --add-port=443/tcp
414
+ else
415
+ echo " Port 443 [TCP] is already open. Skipping."
416
+ fi
417
+
418
+ echo " Reload configuration..."
419
+ sudo firewall-cmd --reload
420
+ echo
421
+ fi
422
422
423
423
# Create a directory for SSL certs if it doesn't exist
424
424
if [ -d " /etc/nginx/cert" ]; then
0 commit comments