Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. LAMP
  3. Basic Auth in LAMP not working

Basic Auth in LAMP not working

Scheduled Pinned Locked Moved Solved LAMP
4 Posts 2 Posters 1.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shrey
    wrote on last edited by
    #1

    Any idea why the following Apache config is not able to enable Basic Auth in my LAMP app?


    ServerName %{HTTP_HOST}
    
    <VirtualHost *:80>
        DocumentRoot /app/data/public
    
        LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
        CustomLog "|/bin/cat" proxy
        ErrorLog "|/bin/cat"
    
        <Directory /app/data/public>
    #        Options +FollowSymLinks
    #        AllowOverride All
    #        Require all granted
            
            Options +FollowSymLinks
            AllowOverride None
    
            AuthType Basic
            AuthName "Secure Content"
            AuthBasicProvider file
            AuthUserFile "/app/data/apache/.htpasswd"
            Require valid-user
    
        </Directory>
    
        # Do not remove this include. It's required for your app to see the Real IP
        Include "/app/code/apache/rpaf.conf"
        # This line can be commented out, if you do no require PHPMyAdmin Access
        Include "/app/code/apache/phpmyadmin.conf"
    
    </VirtualHost>
    
    
    matix131997M 1 Reply Last reply
    1
    • S shrey

      Any idea why the following Apache config is not able to enable Basic Auth in my LAMP app?


      ServerName %{HTTP_HOST}
      
      <VirtualHost *:80>
          DocumentRoot /app/data/public
      
          LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
          CustomLog "|/bin/cat" proxy
          ErrorLog "|/bin/cat"
      
          <Directory /app/data/public>
      #        Options +FollowSymLinks
      #        AllowOverride All
      #        Require all granted
              
              Options +FollowSymLinks
              AllowOverride None
      
              AuthType Basic
              AuthName "Secure Content"
              AuthBasicProvider file
              AuthUserFile "/app/data/apache/.htpasswd"
              Require valid-user
      
          </Directory>
      
          # Do not remove this include. It's required for your app to see the Real IP
          Include "/app/code/apache/rpaf.conf"
          # This line can be commented out, if you do no require PHPMyAdmin Access
          Include "/app/code/apache/phpmyadmin.conf"
      
      </VirtualHost>
      
      
      matix131997M Offline
      matix131997M Offline
      matix131997
      wrote on last edited by matix131997
      #2

      @shrey
      Correct the line

      AllowOverride None
      
             AuthType Basic
             AuthName "Secure Content"
             AuthBasicProvider file
             AuthUserFile "/app/data/apache/.htpasswd"
             Require valid-user
      
         </Directory>"
      

      to

      AllowOverride All
      
             Require valid-user
             AuthName "Cloudron LDAP Authentication"
             AuthBasicProvider ldap
             AuthType Basic
             AuthLDAPURL ${CLOUDRON_LDAP_URL}/${CLOUDRON_LDAP_USERS_BASE_DN}?username?sub?(username=*)
             AuthLDAPBindDN ${CLOUDRON_LDAP_BIND_DN}
             AuthLDAPBindPassword ${CLOUDRON_LDAP_BIND_PASSWORD}
         </Directory>
      

      This is a ready-made way through Cloudron and you can create a special "user" account for authorization purposes.

      S 1 Reply Last reply
      1
      • matix131997M matix131997

        @shrey
        Correct the line

        AllowOverride None
        
               AuthType Basic
               AuthName "Secure Content"
               AuthBasicProvider file
               AuthUserFile "/app/data/apache/.htpasswd"
               Require valid-user
        
           </Directory>"
        

        to

        AllowOverride All
        
               Require valid-user
               AuthName "Cloudron LDAP Authentication"
               AuthBasicProvider ldap
               AuthType Basic
               AuthLDAPURL ${CLOUDRON_LDAP_URL}/${CLOUDRON_LDAP_USERS_BASE_DN}?username?sub?(username=*)
               AuthLDAPBindDN ${CLOUDRON_LDAP_BIND_DN}
               AuthLDAPBindPassword ${CLOUDRON_LDAP_BIND_PASSWORD}
           </Directory>
        

        This is a ready-made way through Cloudron and you can create a special "user" account for authorization purposes.

        S Offline
        S Offline
        shrey
        wrote on last edited by shrey
        #3

        @matix131997 said in Basic Auth in LAMP not working:

        AllowOverride All

        Strangely, this is working in Firefox, but not Chrome (tried Incognito).

        Correction: it works (had to clear site data & cookies).

        matix131997M 1 Reply Last reply
        1
        • S shrey

          @matix131997 said in Basic Auth in LAMP not working:

          AllowOverride All

          Strangely, this is working in Firefox, but not Chrome (tried Incognito).

          Correction: it works (had to clear site data & cookies).

          matix131997M Offline
          matix131997M Offline
          matix131997
          wrote on last edited by
          #4

          @shrey This is interesting. I hadn't noticed before that you had a complete different way of authorization. That's why I made an edit to the post and gave you the exact instruction, which is already implemented as standard.

          1 Reply Last reply
          1
          • girishG girish has marked this topic as solved on
          • girishG girish moved this topic from Support on

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Bookmarks
          • Search