Configure protected directories in Apache - Error ( Please Help )

Hi Team

I had configured with the .htaccess and htpasswd file for the requested user and 100% sure its correct.

I did the same task recently which got success but this one got failed.

Could you please help on this.

Arun B

Team - Could you please update on this request?

@Inderpreet @rahulsoni - Can you please help on this.

Arun B

  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/

how did you do htpasswd file and did your curl command gave correct response


1 Like

Hello, Sasi
You can view this things through the web preview button and option is available in the terminal top mid (plus sign). You need to write correct port to view the web page.

where exactly i can view this, any how this task is heck confusing.

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?