Search code examples
phpamazon-web-servicesmagento2bitnamihttp-authentication

allow HTTP AUTHENTICATION for PHP - bitnami lampstack


I have an amazon aws server. I have installed bitnami lampstack to run site. My php version is 7.0.18.

I want to allow the HTTP AUTHENTICATION for PHP for a payment notificaiton. My server api is apache 2.0 handler. I am not able to get an idea that how http authentication would work.

Can any one please help me that what it is and how i can enable it. By the way my site is in magento 2.


Solution

  • Bitnami Developer here,

    Based on https://docs.bitnami.com/aws/components/apache/#how-to-create-a-password-to-protect-access-to-an-application, you should edit the /opt/bitnami/apps/magento/conf/httpd-app.conf in your instance. This is an example:

    <Directory "/opt/bitnami/apps/APPNAME/htdocs">
      ...
        AuthType Basic
        AuthName MyAuthName
        AuthUserFile "/opt/bitnami/apache2/APPNAME_users"
        Require valid-user
      ...  
    
      <IfVersion >= 2.3>
      # Require all granted
      </IfVersion>
      ...
    </Directory>
    

    Another option would be editing /opt/bitnami/apps/magento/conf/htaccess.conf.

    After adapting the configuration to your needs, restart Apache:

    sudo /opt/bitnami/ctlscript.sh restart apache