Replace #ServerName in httpd.conf
with ServerName Localhost
and that will remove error your getting.
Thanks for your response. I did restart the httpd service. so which part is not necessary?
Also in the .htaccess file the line which says “Require valid-user” should be exactly that correct? or should the valid-user word be replaced by the user name for which the password is created and stored in the /etc/httpd/.htpasswd file?
Thanks for your suggestion. By replacing #ServerName with ServerName localhost results in returning syntax ok when you issue the command httpd -t
Apparently an extra slash at the end of the url was needed to return the contents of index.html correctly
So the correct curl command is curl -u username:password http://<host_name>:<port_num>/<directory_name>/
I was initially confused by this as well. I ended up placing Require valid-user in the .htaccess file.
Hi @satagrawal,
Did you add/append the new directory to the <Directory “/var/www/html”> section in /etc/httpd/conf/httpd.conf like so /var/www/html/<new-directory> ?
Yes Require valid-user exactly as is should be in the .htaccess file
That is correct
Attempted few times doing all the possible stated above, still getting the Internal server Error message .
Guys pls help me here, thanks!
Conf file: even syntax is OK.
<Directory “/var/www/html”>
AllowOverride AuthConfig
DocumentRoot “/var/www/html”
Relax access to content within /var/www.
<Directory “/var/www”>
AllowOverride None
# Allow open access:
Require all granted
.htaccess:
[tony@stapp01 ~]$ cat /var/www/html/sysops/.htaccess
AuthType Basic
AuthName “Restricted Content”
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
You have to put a slash after sysops in your curl command
curl -u rose:<password> http://stapp01:8080/sysops/
share you httpd config file:
/etc/httpd/conf/httpd.conf
Directory should be “/var/www/html/sysops” in the above
Please read this forum carefully, you have all your answers in here…!!!
Will share conf file.
snippet of conf file:
ServerName 172.16.238.11:8080
Deny access to the entirety of your server’s filesystem. You must
explicitly permit access to web content directories in other
blocks below.
AllowOverride none Require all denied
Note that from this point forward you must specifically allow
particular features to be enabled - so if something’s not working as
you might expect, make sure that you have specifically enabled it
below.
DocumentRoot: The directory out of which you will serve your
documents. By default, all requests are taken from this directory, but
symbolic links and aliases may be used to point to other locations.
<Directory “/var/www/html/data”>
AllowOverride AuthConfig
DocumentRoot “/var/www/html”
Relax access to content within /var/www.
<Directory “/var/www”>
AllowOverride None
# Allow open access:
Require all granted
Further relax access to the default document root:
<Directory “/var/www/html”>
#
# Possible values for the Options directive are “None”, “All”,
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that “MultiViews” must be named explicitly — “Options All”
# doesn’t give it to you.
#
# The Options directive is both complicated and important. Please see
# core - Apache HTTP Server Version 2.4
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted

thor@jump_host /$ curl -u jim:Rc5C9EyvbU http://stapp02:8080/data/
500 Internal Server ErrorInternal 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.
Config file looks good. Time to check your error log file.
tail -100 /etc/httpd/logs/error_log
@ramashish.sharma pls look into the logs!
banner@stapp03’s password:
Last login: Tue Aug 25 18:52:06 2020 from jump_host.linuxprotecteddirhttpd_app_net
[banner@stapp03 ~]$ sudo tail -100 /etc/httpd/logs/error_log
[sudo] password for banner:
[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/: Nomatching DirectoryIndex (index.html,index.php) found, and server-generated directory index forbidden by Options directive
[Tue Aug 25 18:46:41.267389 2020] [suexec:notice] [pid 346] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Aug 25 18:46:41.350870 2020] [lbmethod_heartbeat:notice] [pid 346] AH02282: No slotmem from mod_heartmonitor
[Tue Aug 25 18:46:41.713619 2020] [mpm_prefork:notice] [pid 346] AH00163: Apache/2.4.6 (CentOS) PHP/7.2.26 configured – resuming normal operations
[Tue Aug 25 18:46:41.713673 2020] [core:notice] [pid 346] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
[Tue Aug 25 18:50:52.565836 2020] [core:alert] [pid 348] [client 172.16.238.3:35890] /var/www/html/data/.htaccess: AuthName takes one argument, the authentication realm (e.g. “Members Only”)
[Tue Aug 25 19:00:09.775875 2020] [mpm_prefork:notice] [pid 346] AH00170: caught SIGWINCH, shutting down gracefully
[Tue Aug 25 19:00:10.884381 2020] [suexec:notice] [pid 434] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Aug 25 19:00:10.910893 2020] [lbmethod_heartbeat:notice] [pid 434] AH02282: No slotmem from mod_heartmonitor
[Tue Aug 25 19:00:10.929577 2020] [mpm_prefork:notice] [pid 434] AH00163: Apache/2.4.6 (CentOS) PHP/7.2.26 configured – resuming normal operations
[Tue Aug 25 19:00:10.929621 2020] [core:notice] [pid 434] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
[Tue Aug 25 19:03:12.611238 2020] [mpm_prefork:notice] [pid 434] AH00170: caught SIGWINCH, shutting down gracefully
[Tue Aug 25 19:03:13.814600 2020] [suexec:notice] [pid 604] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Aug 25 19:03:13.850205 2020] [lbmethod_heartbeat:notice] [pid 604] AH02282: No slotmem from mod_heartmonitor
[Tue Aug 25 19:03:13.954144 2020] [mpm_prefork:notice] [pid 604] AH00163: Apache/2.4.6 (CentOS) PHP/7.2.26 configured – resuming normal operations
[Tue Aug 25 19:03:13.954188 2020] [core:notice] [pid 604] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
[Tue Aug 25 19:09:36.772199 2020] [mpm_prefork:notice] [pid 604] AH00170: caught SIGWINCH, shutting down gracefully
[Tue Aug 25 19:09:38.006222 2020] [suexec:notice] [pid 626] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Aug 25 19:09:38.034339 2020] [lbmethod_heartbeat:notice] [pid 626] AH02282: No slotmem from mod_heartmonitor
[Tue Aug 25 19:09:38.089105 2020] [mpm_prefork:notice] [pid 626] AH00163: Apache/2.4.6 (CentOS) PHP/7.2.26 configured – resuming normal operations
[Tue Aug 25 19:09:38.089151 2020] [core:notice] [pid 626] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
[Tue Aug 25 19:10:42.006017 2020] [core:alert] [pid 628] [client 172.16.238.3:36152] /var/www/html/data/.htaccess: AuthName takes one argument, the authentication realm (e.g. “Members Only”)

