Home > Blockchain >  How to write rewrite rule for a directory and its content Nginx EC2
How to write rewrite rule for a directory and its content Nginx EC2

Time:10-25

I am new to Webserver configurations etc.

My question is how can I write a rule for a root directory and all the content to that if someone tries directly a not authorised error appears.

enter image description here

eg in the picture prevent access to ajax and all thats contained

CodePudding user response:

the config below will take care of this: (it is considered that the directory ajax is located in root directory you defined in your nginx config, otherwise you have to specify full address of your ajax directory relative to your root directory.)

location ~* /ajax/* {
        return 403;
}
  • Related