3

I am attempting to host my own website with an Apache web server on Debian, but have reached this problem.

When I try to go to my site at example.com it immediately asks for me to authenticate with a username and password. I do not know what the username and password is and then it leads to a 401 page.

I just want to create a simple website and do not want this authentication.

  • You need to use SSH (shell) of a control panel file manager to check the file permissions of the directory and files. Typically, there is an Apache user that owns these files and has permission to these file. It is likely you created your HTML file(s), copied them to the web site, then expected it to work without setting owner, group, and permissions of the file(s). You will need to set the file owner, group, and permissions to be the user and group of the Apache user and set permission to at least read the files. – closetnoc Dec 23 '16 at 0:50
  • I changed the ownership and group of the html file to user:user and the permission is 0755. – Andrew Dec 23 '16 at 1:04
  • It still does not work with the same error. Do I need to change the ownership of other folder/files? – Andrew Dec 23 '16 at 1:05
  • Check the owner of the directory. That should be a clue. You want the files within your web space to match that user name. Your HTML file should be read for user*(owner), *group, and other as well as write for user*(owner). Push comes to shove, you can always try *root and adjust the permissions up a little at a time. Something should work. If your sites directory is /var/www, then the ownership should be root. – closetnoc Dec 23 '16 at 1:17
  • @closetnoc If this was a file permissions/ownership problem then I don't think you'd be prompted to "authenticate with a username and password" and rejected with a 401? You'd simply be blocked with a 403. This sounds more like an HTTP authentication problem, perhaps further up the directory tree. – MrWhite Dec 23 '16 at 19:37
1

It turns out that I just had conflicting port forwarding on my router for port 80. After I fixed the conflict, I now longer received this error.

Thank you for your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.