I am setting up a virtualhost that requires a password for a directory. I checked and the following entry works locally, but not on the server (Ubuntu). Do you have any tips what difference could be between the local and remote environment?
<VirtualHost example.com:443>
ServerName example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/html/public">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/htpasswd/.htpasswd
Require valid-user
</Directory>
</VirtualHost>
The server has one more virtualhost in the /etc/apache2/sites-available/
folder, named 000-default.conf. This vhosts file is the same as mine, but without the Directory specification and with *:80 and without a ServerName.
I have 2 DNS-es for the server, I want one of them to request for a password.
${APACHE_LOG_DIR}
is not specified. I will change it now to something absolute.