Home  >  Q&A  >  body text

How does nginx restrict users from accessing pages after logging in?

Use nginx for static caching, but non-logged-in users are not allowed to access the data display page. If configured as follows, even logged-in users cannot access it. Xiaobai please answer

  #不登录情况下禁止直接访问
    location ^~ /admin/{
        deny all;
    }
    #location ^~ /js/{
    #    deny all;
    #}
给我你的怀抱给我你的怀抱2714 days ago585

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 17:11:11

    You can use http auth to restrict access. A box will pop up during access, allowing you to enter your account password. After entering, you can have unlimited access.

    For specific configuration, please refer to nginx http auth module:

    http://nginx.org/en/docs/http/ngx_http_auth_basic_module.html

    reply
    0
  • Cancelreply