Configure Protected Directories in Apache puzzle

Created directory, added user, created .htaccess file,
not clear on updating httpd configuration file
where exactly i have to do in Httpd config file?
which line has to be changed?
also whenever i do curl command iti says connection is not established

@Inderpreet Can you pls help

curl -u yousuf:GyQkFRVNr3 http://stapp01:8080/itadm

  1. create directory

  2. Adding user:
    htpasswd -c /etc/httpd/.htpasswd

  3. Create basic .htaccess file
    cat /var/www/html/itadmin/.htaccess <----------- itadmin is the new directory created
    AuthType Basic
    AuthName “Restricted Content”
    AuthUserFile /etc/httpd/.htpasswd
    Require valid-user

  4. Update the httpd configuration file with this entry
    cat /etc/httpd/conf/httpd.conf
    <Directory “/var/www/html/itadmin”> <--------- itadmin is the new directory name
    AllowOverride AuthConfig

  5. Scp /tmp/index.html file from jumpbox to app server (/var/www/html/itadmin/index.html).

  6. Restart httpd service

  7. Test connectivity
    curl -u yousuf:GyQkFRVNr3 http://stapp01:8080/itadmin/

there are some hidden tasks like installing httpd apache itself, as www/html is not available in var
then where should be .htaccess and htpasswd files have to be created are they existing or have to be created by user, using a correct port number to view the web page? which port number should be used?

@Tej-Singh-Rana @Inderpreet

pls check below my entire commands for the task. pls tell me where iam going wrong.

then it is asking for password, does copy and paste works here or do i need to manually type the password

ssh banner@stapp03
The authenticity of host ‘stapp03 (172.16.238.12)’ can’t be established.
ECDSA key fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs.
ECDSA key fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘stapp03,172.16.238.12’ (ECDSA) to the list of known hosts.
banner@stapp03’s password:
[banner@stapp03 ~]$ sudo su

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for banner:
Sorry, try again.
[sudo] password for banner:
[root@stapp03 banner]# yum install httpd -y
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
epel/x86_64/metalink | 31 kB 00:00:00

  • base: linux.darkpenguin.net
  • epel: mirrors.n-ix.net
  • extras: mirror.alpix.eu
  • remi-php72: mirror.23media.com
  • remi-safe: mirror.23media.com
  • updates: linux.darkpenguin.net
    base | 3.6 kB 00:00:00
    epel | 4.7 kB 00:00:00
    extras | 2.9 kB 00:00:00
    remi-php72 | 3.0 kB 00:00:00
    remi-safe | 3.0 kB 00:00:00
    updates | 2.9 kB 00:00:00
    (1/9): base/7/x86_64/group_gz | 153 kB 00:00:00
    (2/9): extras/7/x86_64/primary_db | 205 kB 00:00:00
    (3/9): epel/x86_64/group_gz | 95 kB 00:00:00
    (4/9): epel/x86_64/updateinfo | 1.0 MB 00:00:00
    (5/9): epel/x86_64/primary_db | 6.9 MB 00:00:00
    (6/9): updates/7/x86_64/primary_db | 3.7 MB 00:00:00
    (7/9): base/7/x86_64/primary_db | 6.1 MB 00:00:00
    (8/9): remi-php72/primary_db | 241 kB 00:00:00
    (9/9): remi-safe/primary_db | 1.8 MB 00:00:01
    Resolving Dependencies
    –> Running transaction check
    —> Package httpd.x86_64 0:2.4.6-90.el7.centos will be updated
    —> Package httpd.x86_64 0:2.4.6-93.el7.centos will be an update
    –> Processing Dependency: httpd-tools = 2.4.6-93.el7.centos for package: httpd-2.4.6-93.el7.centos.x86_64
    –> Running transaction check
    —> Package httpd-tools.x86_64 0:2.4.6-90.el7.centos will be updated
    —> Package httpd-tools.x86_64 0:2.4.6-93.el7.centos will be an update
    –> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================

Package Arch Version Repository Size

Updating:
httpd x86_64 2.4.6-93.el7.centos base 2.7 M
Updating for dependencies:
httpd-tools x86_64 2.4.6-93.el7.centos base 92 k

Transaction Summary

Upgrade 1 Package (+1 Dependent package)

Total download size: 2.8 M

Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): httpd-tools-2.4.6-93.el7.centos.x86_64.rpm | 92 kB 00:00:00
(2/2): httpd-2.4.6-93.el7.centos.x86_64.rpm | 2.7 MB 00:00:00

Total 16 MB/s | 2.8 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : httpd-tools-2.4.6-93.el7.centos.x86_64 1/4
Updating : httpd-2.4.6-93.el7.centos.x86_64 2/4
Cleanup : httpd-2.4.6-90.el7.centos.x86_64 3/4
Cleanup : httpd-tools-2.4.6-90.el7.centos.x86_64 4/4
Verifying : httpd-tools-2.4.6-93.el7.centos.x86_64 1/4
Verifying : httpd-2.4.6-93.el7.centos.x86_64 2/4
Verifying : httpd-tools-2.4.6-90.el7.centos.x86_64 3/4
Verifying : httpd-2.4.6-90.el7.centos.x86_64 4/4

Updated:
httpd.x86_64 0:2.4.6-93.el7.centos

Dependency Updated:
httpd-tools.x86_64 0:2.4.6-93.el7.centos

Complete!
[root@stapp03 banner]# ls -al
total 20
drwx------ 2 banner banner 4096 Jan 25 2020 .
drwxr-xr-x 3 root root 4096 Jan 25 2020 …
-rw-r–r-- 3 banner banner 18 Oct 30 2018 .bash_logout
-rw-r–r-- 3 banner banner 193 Oct 30 2018 .bash_profile
-rw-r–r-- 3 banner banner 231 Oct 30 2018 .bashrc
[root@stapp03 banner]# cd …
[root@stapp03 home]# ls -al
total 12
drwxr-xr-x 3 root root 4096 Jan 25 2020 .
drwxr-xr-x 1 root root 4096 Aug 5 23:22 …
drwx------ 2 banner banner 4096 Jan 25 2020 banner
[root@stapp03 home]# ls
banner
[root@stapp03 home]# ls -al
total 12
drwxr-xr-x 3 root root 4096 Jan 25 2020 .
drwxr-xr-x 1 root root 4096 Aug 5 23:22 …
drwx------ 2 banner banner 4096 Jan 25 2020 banner
[root@stapp03 home]# cd var
bash: cd: var: No such file or directory
[root@stapp03 home]# cd /var
[root@stapp03 var]# cd www
[root@stapp03 www]# cd html
[root@stapp03 html]# pwd
/var/www/html
[root@stapp03 html]# mkdir sysops
[root@stapp03 html]# pwd
/var/www/html
[root@stapp03 html]# htpasswd -c /etc/httpd/.htpasswd mark
New password:
Re-type new password:
Adding password for user mark
[root@stapp03 html]# cd /var/www/html/sysops
[root@stapp03 sysops]# vi .htaccess
[root@stapp03 sysops]# vi /etc/httpd/conf/httpd.conf
[root@stapp03 sysops]# exit
exit
[banner@stapp03 ~] exit logout Connection to stapp03 closed. thor@jump_host / sudo scp -r /tmp/index.html [email protected]:/tmp

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for thor:
The authenticity of host ‘172.16.238.11 (172.16.238.11)’ can’t be established.
ECDSA key fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs.
ECDSA key fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘172.16.238.11’ (ECDSA) to the list of known hosts.
[email protected]’s password:
Permission denied, please try again.
[email protected]’s password:
Permission denied, please try again.
[email protected]’s password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
lost connection
thor@jump_host / sudo scp -r /tmp/index.html [email protected]:/tmp The authenticity of host ‘172.16.238.12 (172.16.238.12)’ can’t be established. ECDSA key fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs. ECDSA key fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added ‘172.16.238.12’ (ECDSA) to the list of known hosts. [email protected]’s password: index.html 100% 51 56.1KB/s 00:00 thor@jump_host / ssh banner@stapp03
banner@stapp03’s password:
Last login: Wed Aug 5 23:25:45 2020 from jump_host.linuxprotecteddirhttpd_app_net
[banner@stapp03 ~] sudo mv /temp/index.html /var/www/html/itadmin/index.html [sudo] password for banner: mv: cannot stat ‘/temp/index.html’: No such file or directory [banner@stapp03 ~] sudo mv /tmp/index.html /var/www/html/itadmin/index.html
mv: cannot move ‘/tmp/index.html’ to ‘/var/www/html/itadmin/index.html’: No such file or directory
[banner@stapp03 ~] sudo mv /tmp/index.html /var/www/html/sysops [banner@stapp03 ~] ls -al
total 24
drwx------ 1 banner banner 4096 Aug 5 23:40 .
drwxr-xr-x 1 root root 4096 Jan 25 2020 …
-rw------- 1 banner banner 14 Aug 5 23:40 .bash_history
-rw-r–r-- 3 banner banner 18 Oct 30 2018 .bash_logout
-rw-r–r-- 3 banner banner 193 Oct 30 2018 .bash_profile
-rw-r–r-- 3 banner banner 231 Oct 30 2018 .bashrc
[banner@stapp03 ~] cd … [banner@stapp03 home] ls -al
total 12
drwxr-xr-x 1 root root 4096 Jan 25 2020 .
drwxr-xr-x 1 root root 4096 Aug 5 23:22 …
drwx------ 1 banner banner 4096 Aug 5 23:40 banner
[banner@stapp03 home] cd … [banner@stapp03 /] cd …
[banner@stapp03 /] cd /var [banner@stapp03 var] cd www
[banner@stapp03 www] cd html [banner@stapp03 html] ls -al
total 12
drwxr-xr-x 3 root root 4096 Aug 5 23:29 .
drwxr-xr-x 1 root root 4096 Apr 2 13:14 …
drwxr-xr-x 2 root root 4096 Aug 5 23:44 sysops
[banner@stapp03 html] cd sysops [banner@stapp03 sysops] ls -al
total 16
drwxr-xr-x 2 root root 4096 Aug 5 23:44 .
drwxr-xr-x 3 root root 4096 Aug 5 23:29 …
-rw-r–r-- 1 root root 102 Aug 5 23:35 .htaccess
-rw-r–r-- 1 banner banner 51 Aug 5 23:42 index.html
[banner@stapp03 sysops] cat /var/www/html/sysops/index.html This is xFusionCorp Industries Protected Directory![banner@stapp03 sysops] systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:httpd(8)
man:apachectl(8)
[banner@stapp03 sysops] systemctl enable httpd Failed to execute operation: The name org.freedesktop.PolicyKit1 was not provided by any .service files [banner@stapp03 sysops] systemctl restart httpd
Failed to restart httpd.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and ‘systemctl status httpd.service’ for details.
[banner@stapp03 sysops] systemctl status httpd ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: man:httpd(8) man:apachectl(8) [banner@stapp03 sysops] sudo systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[banner@stapp03 sysops] sudo systemctl restart httpd [banner@stapp03 sysops] sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-08-05 23:48:58 UTC; 11s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 566 (httpd)
Status: “Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec”
CGroup: /docker/7980af042423d43c66c6e4c8c8dc5c48b0f0b624299d4c92beba5106bc2125d4/system.slice/httpd.service
├─566 /usr/sbin/httpd -DFOREGROUND
├─567 /usr/sbin/httpd -DFOREGROUND
├─568 /usr/sbin/httpd -DFOREGROUND
├─569 /usr/sbin/httpd -DFOREGROUND
├─570 /usr/sbin/httpd -DFOREGROUND
└─571 /usr/sbin/httpd -DFOREGROUND

Aug 05 23:48:58 stapp03 systemd[1]: Starting The Apache HTTP Server…
Aug 05 23:48:58 stapp03 httpd[566]: AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, usin… message
Aug 05 23:48:58 stapp03 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
[banner@stapp03 sysops]$ curl -u mark:8FmzjvFU6S http://stapp03:8080/sysops

500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

[banner@stapp03 sysops]$ curl -u mark:8FmzjvFU6S http://stapp03:8080/sysops

Did you do entry in the document root in httpd.conf for a new directory you created in the output?

hor@jump_host /$ ssh tony@stapp01
The authenticity of host ‘stapp01 (172.16.238.10)’ can’t be established.
ECDSA key fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs.ECDSA key fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘stapp01,172.16.238.10’ (ECDSA) to the list of known hosts.
tony@stapp01’s password:
[tony@stapp01 ~]$ cd /var
[tony@stapp01 var]$ cd www
[tony@stapp01 www]$ cd html
[tony@stapp01 html]$ mkdir sysops
[tony@stapp01 html]$ pwd
/var/www/html
[tony@stapp01 html]$ htpasswd -c /etc/httpd/.htpasswd john
htpasswd: cannot create file /etc/httpd/.htpasswd[tony@stapp01 html]$ sudo htpasswd -c /etc/httpd/.htpasswd john

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for tony:
Sorry, try again.
[sudo] password for tony:
New password:
Re-type new password:
Adding password for user john
[tony@stapp01 html]$ chown apache:apache /etc/httpd/.htpasswd
chown: changing ownership of ‘/etc/httpd/.htpasswd’: Operation not permitted
[tony@stapp01 html]$ sudo su
[root@stapp01 html]# chown apache:apache /etc/httpd/.htpasswd
[root@stapp01 html]# chmod 644 /etc/httpd/.htpasswd
[root@stapp01 html]# cd /var/www/html/sysops
[root@stapp01 sysops]# vi .htaccess
[root@stapp01 sysops]# vi /etc/httpd/conf/httpd.conf
[root@stapp01 sysops]# cat ^C
[root@stapp01 sysops]# cat .htaccess
AuthType Basic
AuthName “Restricted Content”
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
[root@stapp01 sysops]# exit
exit
[tony@stapp01 html]$ exit
logout
Connection to stapp01 closed.
thor@jump_host /$ sudo scp -r /tmp/index.html [email protected]:/tmp

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for thor:
The authenticity of host ‘172.16.238.10 (172.16.238.10)’ can’t be established.
ECDSA key fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs.
ECDSA key fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘172.16.238.10’ (ECDSA) to the list of known hosts.
[email protected]’s password:
index.html 100% 51 62.2KB/s 00:00
thor@jump_host /$ ssh tony@stapp01
tony@stapp01’s password:
Last login: Tue Aug 11 00:58:33 2020 from jump_host.linuxprotecteddirhttpd_app_net
[tony@stapp01 ~]$ sudo mv /tmp/index.html /var/www/html/sysops
[sudo] password for tony:
[tony@stapp01 ~]$ cat /var/www/html/sysops
cat: /var/www/html/sysops: Is a directory
[tony@stapp01 ~]$ cat /var/www/html/sysops/index.html
This is xFusionCorp Industries Protected Directory![tony@stapp01 ~]$ $ curl -u mark:8FmzjvFU6S http://stapp03:8080/sysops/ exit
logout
Connection to stapp01 closed.
thor@jump_host /$ curl -u john:dCV3szSGNA http://stapp01:8080/sysops/
curl: (7) Failed connect to stapp01:8080; Connection refused
thor@jump_host /$ ssh tony@stapp01
tony@stapp01’s password:
Last login: Tue Aug 11 01:07:36 2020 from jump_host.linuxprotecteddirhttpd_app_net
[tony@stapp01 ~]$ curl -u john:dCV3szSGNA http://stapp01:8080/sysops/
curl: (7) Failed connect to stapp01:8080; Connection refused
[tony@stapp01 ~]$ cat /etc/httpd/logs/error_log
cat: /etc/httpd/logs/error_log: Permission denied
[tony@stapp01 ~]$ sudo curl -u john:dCV3szSGNA http://stapp01:8080/sysops/
[sudo] password for tony:
Sorry, try again.
[sudo] password for tony:
curl: (7) Failed connect to stapp01:8080; Connection refused
[tony@stapp01 ~]$ sudo su
[root@stapp01 tony]# curl -u john:dCV3szSGNA http://stapp01:8080/sysops/
curl: (7) Failed connect to stapp01:8080; Connection refused
[root@stapp01 tony]# cat /etc/httpd/logs/error_log
[Tue Jan 07 16:48:13.426245 2020] [suexec:notice] [pid 235] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 172.17.0.2. Set the ‘ServerName’ directive globally to suppress this message
[Tue Jan 07 16:48:13.448647 2020] [lbmethod_heartbeat:notice] [pid 235] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 07 16:48:13.477225 2020] [mpm_prefork:notice] [pid 235] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured – resuming normal operations
[Tue Jan 07 16:48:13.477269 2020] [core:notice] [pid 235] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
[Tue Jan 07 17:01:19.920118 2020] [mpm_prefork:notice] [pid 235] AH00170: caught SIGWINCH, shutting down gracefully
[Tue Jan 07 17:01:21.039421 2020] [suexec:notice] [pid 302] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 172.17.0.2. Set the ‘ServerName’ directive globally to suppress this message
[Tue Jan 07 17:01:21.057366 2020] [lbmethod_heartbeat:notice] [pid 302] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 07 17:01:21.073887 2020] [mpm_prefork:notice] [pid 302] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured – resuming normal operations
[Tue Jan 07 17:01:21.073925 2020] [core:notice] [pid 302] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
[Tue Jan 07 17:56:31.674688 2020] [suexec:notice] [pid 153] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 172.17.0.2. Set the ‘ServerName’ directive globally to suppress this message
[Tue Jan 07 17:56:31.693602 2020] [lbmethod_heartbeat:notice] [pid 153] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 07 17:56:31.709042 2020] [mpm_prefork:notice] [pid 153] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured – resuming normal operations
[Tue Jan 07 17:56:31.709086 2020] [core:notice] [pid 153] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
[Tue Jan 07 18:12:16.894145 2020] [mpm_prefork:notice] [pid 153] AH00170: caught SIGWINCH, shutting down gracefully
[Tue Jan 07 18:12:18.017767 2020] [suexec:notice] [pid 385] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 172.17.0.2. Set the ‘ServerName’ directive globally to suppress this message
[Tue Jan 07 18:12:18.035993 2020] [lbmethod_heartbeat:notice] [pid 385] AH02282: No slotmem from mod_heartmonitor
[Tue Jan 07 18:12:18.061043 2020] [mpm_prefork:notice] [pid 385] AH00163: Apache/2.4.6 (CentOS) PHP/7.2.26 configured – resuming normal operations
[Tue Jan 07 18:12:18.061080 2020] [core:notice] [pid 385] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
sh: /usr/sbin/sendmail: No such file or directory
[Wed Jan 08 06:13:19.588078 2020] [suexec:notice] [pid 168] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 172.17.0.3. Set the ‘ServerName’ directive globally to suppress this message
[Wed Jan 08 06:13:19.606738 2020] [lbmethod_heartbeat:notice] [pid 168] AH02282: No slotmem from mod_heartmonitor
[Wed Jan 08 06:13:19.651100 2020] [mpm_prefork:notice] [pid 168] AH00163: Apache/2.4.6 (CentOS) PHP/7.2.26 configured – resuming normal operations
[Wed Jan 08 06:13:19.651164 2020] [core:notice] [pid 168] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
[Wed Jan 08 06:14:32.865753 2020] [autoindex:error] [pid 170] [client 127.0.0.1:57770] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[root@stapp01 tony]# date
Tue Aug 11 01:17:02 UTC 2020
[root@stapp01 tony]# ^C
[root@stapp01 tony]# netstat -tlpen | grep 8080
bash: netstat: command not found
[root@stapp01 tony]# curl -u john:dCV3szSGNA http://stapp01:8080/sysops/
curl: (7) Failed connect to stapp01:8080; Connection refused

can you explain what you are asking, in httpd.conf i have updated directory url
where it is not commented

most of the httpd.conf is commented

curl command is giving connection refused error in this task, is this a problem from your back end side?

@Inderpreet

[root@stapp01 tony]# curl -u john:dCV3szSGNA http://stapp01:8080/sysops/
curl: (7) Failed connect to stapp01:8080; Connection refused

AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 172.16.238.12. Set the ‘ServerName’ directive globally to suppress this message is the error message i got which seems to be error from your side.

pls check i have done all the steps right.
@Inderpreet @Tej-Singh-Rana @ramashish.sharma

You have many errors in your httpd conf file as per your screenshot.

  1. From bottom of your screenshot, see 2nd line: AuthName takes one argument
  2. From what you highlighted in yellow in your screenshot, from that 4th line in top order /var/www/html: Mo matching Directory Index

I’m just sharing a screenshot of how both the files should look like.

This is a snippet from httpd conf file

This is .htaccess file
sasi2

helloRama, directory path can be updated at document root with the required directory path “/var/www/html/sysops” i see you updated above the document root. and i also see there are more than 2-3 instances of directory in the config file when i asked where exactly the path has to be updated i got answer saying as long as it is updated atleast 1 place - directory path it should be fine.

i did exactly used same code in my .htaccess

what error you faced when you submitted your task and later marked as success? also you mentioned–" Set the ‘ServerName’ directive globally to suppress this message is the error message i got which seems to be error from your side" error will not stop you from success. also i did httpd -t
it said syntax is good and it only gave server name error.

when i searched online for servername suppression it said to use ServerName LocalHost
in ServerName section of the config file.

i hoped @Inderpreet can help me why this task has been giving nightmares i even got this task in my dreams in the night.

while actual 3 steps of the task are relatively easy, 1) create directory 2) create user and file and attach a password 3)copy index.html from jumphost to app server

curl command is where something didnt work at all for me, all i see is --could not determine fully qualified domain name 172.16.238.12 set in server name directive globally suppress it.

it is really depressing to see tasks failing inspite of trying all the available options - taking help from community, check online. iam paid user of the site i hoped i get a proper response from technical team of the kodekloud. no response even after posting in multiple threads. will some one care to give the direction when you see the error messages we are getting?

@Tej-Singh-Rana @mummanasuresh82 @Inderpreet @Ayman

Any update on this why i keep getting the message : could not reliably determine the servers fully qualified domain name, using 172.16.238.12 , set the servername directive gobally to suppress this message

can you pls let me know what went wrong in this task.

@Inderpreet @Tej-Singh-Rana @Ayman

@Sasi this warning can be ignored I think, there are some other errors what ramashish mentioned above ^^. Those need to be resolved I believe to make it work. I you have your Apache config and .htaccess files could you send me those ?


attached apache config and .htaccess file
pls take a look

@Inderpreet above is content of .htaccess file, even this task i hav tried 10-15 times to troubleshoot to recover from errors when ramashish told me server name directive globally error will not stop me to get task complete, then i clicked finish button but i got task failure.

@Sasi you have added the /var/www/html/finance document root so even if your website was running it was supposed to fail because it will run with URL http://<app-server-hostname>:<port> but as per question it is supposed to be run with URL http://<app-server-hostname>:<port>/finance so you need not to add/update the document root just keep it default and do the rest of the settings.

Hi @Inderpreet ramashish and others have used full path in document root, i have verified others folks screen shots they got success in thier tasks. ramashish adviced to use /var/www/html/itadmin

/var/www/html/new directory created as per task

@Sasi with time we keep on making changes in some questions so just make sure to follow the instructions carefully.

@Inderpreet But i did ask kodekloud team to helpme and waited for 1 week, why curl command is not giving response, @Tej-Singh-Rana response is appreciated when needed and we are wanting help, community says to use a command, or config file format, which one should we go with and if kodekloud team doesnot provide response in time?
appreciate if you revert back this task, i can complete this task now.

@Sasi share your KKE username, we can set this Pending for you. Did you already get today’s task btw ?

@Inderpreet my KKE name is @Sasi i did not get task yet for todaY

Thanks,
Sasi