Password protect single file

Tracy Perry

Active Member
#1
Specifically, I'm trying to password protect the admin.php under xenForo. I've tried just about every combo of the context settings I could think of and non of them appear to work.

How exactly do you do this?
 

lsmichael

Active Member
#2
Howdy,

Yes, we need probably need a guide for this, as well.

I assume you're setting up a static context. Are you getting asked for a username and password when you try to view the page? If not, my guess is you set up the context location or URI wrong. Did you set up a realm with your user and password? (Virtual Hosts > Security)

But, in the end, we need a guide for this as well. Thanks for telling us what you're having trouble with. There's a lot of things that need doing, but I'll try to bump that up the list.

m
 

Tracy Perry

Active Member
#3
Howdy,

Yes, we need probably need a guide for this, as well.

I assume you're setting up a static context. Are you getting asked for a username and password when you try to view the page? If not, my guess is you set up the context location or URI wrong. Did you set up a realm with your user and password? (Virtual Hosts > Security)

But, in the end, we need a guide for this as well. Thanks for telling us what you're having trouble with. There's a lot of things that need doing, but I'll try to bump that up the list.

m
It prompts... and then goes to a 404 error page.
If you want, a little later I can set it up on my site on an alternative port with a test setup and you can see what I am talking about. I can even give you an admin account on it to work with.
 

lsmichael

Active Member
#4
Well, that's odd. It sounds more like a an issue with the files being in the wrong place or perhaps your rewrite rules. I'd be happy to check out your server for you. It'd probably be best for me to have ssh access. You're sure you have a file there that can be accessed, right?

m
 
#5
I did this before and it was pretty easy. I think the example comes with one set up. Did you try following that and just changing what needs to be changed?
 

Tracy Perry

Active Member
#7
Well, that's odd. It sounds more like a an issue with the files being in the wrong place or perhaps your rewrite rules. I'd be happy to check out your server for you. It'd probably be best for me to have ssh access. You're sure you have a file there that can be accessed, right?

m
SSH is only by keys. I know the file is there because this works fine with nginx. It also occurs without any re-write rules (mainly the friendly URL ones for xenForo's htaccess example) in place.

Code:
location = /admin.php {
    auth_basic "Administrator Login";
    auth_basic_user_file /topsecret/stuff/the.pass.word;
    try_files $uri =404;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME
    $document_root$fastcgi_script_name;
    include /etc/nginx/fastcgi_params;
    }
 
Top