[SOLVED] Apache2 .htpasswd and 000-default.conf problem
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I configured Apache2 .htpasswd and 000-default.conf, an restarted the server.
Now i am being asked a password correctly only when i connect through my own LAN Network, but still now protection when i connect from outside my own Wifi.
An .htaccess login will persist until all instances of the browser are closed. Once you login, opening a new tab or window will not require another login. Close all browser windows, then try from outside the LAN first...
Presuming here that you did not let your browser save the login the first time you used it...
I meant after i thought i configured correctly, i used my cell phone in LTE mode and try to connect to my server.
It did connect but with no password being asked.
Also i did not use .htaccess to configured, i use method #1 from DigitalOcean .htpasswd and 000-default.conf. Option 1: Configuring Access Control within the Virtual Host Definition (Preferred)
OK
Please post what you added to the config file (yes, it is better to add auth_config to a config file than use .htpasswd)
and please clarify "connect through my own LAN Network" are you doing both the phone connect and that with the domain name?
I do not have access to my server right now, i will post the config tomorrow, but what i meant about Lan Network is that my server is hosted on my own home computer, its not hosted on a Domain Site or ISP, i did get a domain name registered and it is configured properly (Nameserver, Arecord, ect...);
The problem is when i later configured Apache2 .htpasswd and 000-default.conf.
The problem is that it does not ask for a password when other people connect from outside my Network (wifi/router/home server).
But when i try to connect from any computer on the same router than my server, it does ask for a password.
P.S. This is a home server, i am playing with, for friends and family, that is why i want to password the access the www.myservername.com.
Years ago on a previous server i had more success configuring .htaccess as per Option 2 of the same website.
But this time i did not add an .htaccess file in /var/www/html.
Are you sure your phone hasn't cached the site? Can you clear the web cache on your phone?
Do you have any other way to test from outside your LAN?
Again, are you using the domain name from within your LAN? (not the IP address)
If you want to email me the domain name, I'd be happy to report what happens from here.
I had friends connecting to my server from there home and still it was not asking for a password, so i revert my configuration 000-default.conf back to default and use methode # 2 creating an .htaccess file and modifying apache2.conf instead of editing 000-default.conf.
It's not the prefered option but option # 1 did not work for some reason.
I work nice now
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.