P
P
pridyrok2015-04-17 05:37:30
Nginx
pridyrok, 2015-04-17 05:37:30

How to block access to /index.php?action=admin using nginx?

How to close access to /index.php?action=admin ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
evnuh, 2015-04-17
@evnuh

Close access with HTTP authentication:

location /index.php?action=admin {
    auth_basic 'Admin Panel';
    auth_basic_user_file admin.passwd;
}

Next, put the file next to admin.passwd, in which you write down hashed logins and passwords (read here: nginx.org/en/docs/http/ngx_http_auth_basic_module.... )
Well, or directly drive them there with plaintext:
admin:{PLAIN}password:welcome to admin zone

P
pridyrok, 2015-04-17
@pridyrok

Thanks for answering.
I tried that, it doesn't work.
I don't understand why...
Maybe because of this?

location / {
                    proxy_pass http://127.0.0.1:81/; #  Apache
                    include /etc/nginx/proxyall;
                }

Yes, just in case, this is the smf forum.
So far I've done this:
set $a "";
                if ( $http_referer ~* (admin|moderate) ) {
                        set $a 1;
                }
                if ($remote_addr !~ 192.192.23.93) {
                        set $a 1$a;
                }
                if ($a = 11) {
                        return 403;
                }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question