I set up Basic authentication with Apache + Passenger, so here’s a memo.
Create a password file for a user named myuser.
# htpasswd -c /usr/local/apache2/.htpasswd myuser
Modify Apache’s configuration file.
# vim /usr/local/apache2/conf/extra/passenger.conf
    PassengerUserSwitching off
    PassengerDefaultUser app
    ServerName example.com
    DocumentRoot "/srv/example.com/current/public"
    ErrorLog "logs/example.com-error_log"
    CustomLog "logs/example.com-access_log" common
    
        AllowOverride all
        Options -MultiViews
        Order allow,deny
        Allow from all
     
    
        AuthType Basic
        AuthName "Please enter your ID and Password"
        AuthUserFile /usr/local/apache2/.htpasswd
        Require user myuser
     
 
Restart Apache
# service httpd restart
That’s all from the Gemba.
【Reference】