From 2efe7d5d68ba29c862a3dc5642fac5c4a92dcdf6 Mon Sep 17 00:00:00 2001 From: the1Riddle Date: Tue, 19 Dec 2023 10:17:52 +0300 Subject: [PATCH 1/4] The readme file --- 0x12-web_stack_debugging_2/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 0x12-web_stack_debugging_2/README.md diff --git a/0x12-web_stack_debugging_2/README.md b/0x12-web_stack_debugging_2/README.md new file mode 100644 index 0000000..f0cd9f4 --- /dev/null +++ b/0x12-web_stack_debugging_2/README.md @@ -0,0 +1,3 @@ +# Web stack debugging #2 + +![image](https://github.com/the1Riddle/alx-system_engineering-devops/assets/125451537/13765a00-ac14-419a-b1ca-da725430690b) From bd61f8f65af8bc1d4e44547fc01b7a7419e71a43 Mon Sep 17 00:00:00 2001 From: the1Riddle Date: Tue, 19 Dec 2023 10:25:18 +0300 Subject: [PATCH 2/4] a script that run whoami command uner the passed user as an argument --- 0x12-web_stack_debugging_2/0-iamsomeoneelse | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 0x12-web_stack_debugging_2/0-iamsomeoneelse diff --git a/0x12-web_stack_debugging_2/0-iamsomeoneelse b/0x12-web_stack_debugging_2/0-iamsomeoneelse new file mode 100644 index 0000000..0b2a447 --- /dev/null +++ b/0x12-web_stack_debugging_2/0-iamsomeoneelse @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# Bash script that accepts one argument +# the script should run the whoami command under the user passed as an argument +# make sure to try your script by passing different users +sudo -u "$1" whoami From 63629a57684e73aaf437aa6bce5bccc3ff6eeb1d Mon Sep 17 00:00:00 2001 From: the1Riddle Date: Tue, 19 Dec 2023 10:30:49 +0300 Subject: [PATCH 3/4] Run Nginx as Nginx --- 0x12-web_stack_debugging_2/1-run_nginx_as_nginx | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 0x12-web_stack_debugging_2/1-run_nginx_as_nginx diff --git a/0x12-web_stack_debugging_2/1-run_nginx_as_nginx b/0x12-web_stack_debugging_2/1-run_nginx_as_nginx new file mode 100644 index 0000000..de01726 --- /dev/null +++ b/0x12-web_stack_debugging_2/1-run_nginx_as_nginx @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# configuring a container to run nginx under nginx user on port 8080 +# without using apt-get remove +chown nginx:nginx /etc/nginx/nginx.conf +chown nginx:nginx /etc/nginx/sites-available/default +chmod u+rwx /etc/nginx/nginx.conf +sed -i "s/#user www-data/user nginx/" /etc/nginx/nginx.conf +sed -i "s/80/8080/" /etc/nginx/sites-available/default +pkill apache2 +su nginx service nginx restart From d7d166b589677325473221182a5a6504e92ba834 Mon Sep 17 00:00:00 2001 From: the1Riddle Date: Tue, 19 Dec 2023 10:33:41 +0300 Subject: [PATCH 4/4] 7 lines or less --- 0x12-web_stack_debugging_2/100-fix_in_7_lines_or_less | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 0x12-web_stack_debugging_2/100-fix_in_7_lines_or_less diff --git a/0x12-web_stack_debugging_2/100-fix_in_7_lines_or_less b/0x12-web_stack_debugging_2/100-fix_in_7_lines_or_less new file mode 100644 index 0000000..f3484a0 --- /dev/null +++ b/0x12-web_stack_debugging_2/100-fix_in_7_lines_or_less @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# making task 1-run_nginx_as_nginx 7 lines long +sed -i "s/80 /8080 /g" /etc/nginx/sites-available/default +sed -i "s/#user www-data/user nginx/g" /etc/nginx/nginx.conf +chmod 755 /etc/nginx/nginx.conf +pkill -9 apache +su nginx -c "service nginx restart"