Home  >  Q&A  >  body text

lnmp - How to set the Nginx server IP to access a certain directory

Anti-empty header host binding is set in the configuration file:
server{

listen 80 default_server;
server_name _;
return 500;

}
In this case, the IP cannot access the website. Currently, I want to allow the IP to access the /phpmyadmin/ directory, but other directories are not allowed to access. How should I configure it?

PHPzPHPz2713 days ago587

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-16 17:17:21

    Comment out this paragraph first, or use the domain name to access phpmyadmin.
    Restrict IP access

    location ~ ^/phpmyadmin/ {
              allow 192.168.1.0/24
              deny all;
    }

    See the answer link on the first floor

    reply
    0
  • Cancelreply