Webinoly is just the perfect tool for NGINX experts. Give it a try!
0 votes
522 views
by Rookie
retagged by
As it shown in the subject, I really don't know where & how I should paste this piece of code to restrict others from accessing a folder called "data".

location ^~ /data {
  deny all;
}

Hope someone can help. Thanks you all!

1 Answer

0 votes
by Talented

Hi,

you tagged your question as htaccess, NGINX does not have a .htaccess file.

Please look into how to add this to your sites NGINX conf file:

https://www.digitalocean.com/community/tutorials/understanding-nginx-server-and-location-block-selection-algorithms

http://nginx.org/en/docs/http/ngx_http_access_module.html#example

by Rookie

Hi,

I'm sorry for that wrong tagging. Actually, I'm just a beginner and found those links hard to follow since they use samples while (I was looking for something direct like the exact path file and block to edit) after installing WordPress through Webinoly.

I need to add this exact snippet which will restrict the data folder that is located inside a subfolder called "rainloop" of my root domain:

location ^~ /data {
  deny all;
}

Hope I explained it well this time.

by Talented

Hi, you need to gain a better understanding of NGINX as Webinoly and your question put you clearly on a DIY path. Please read and understand that article, it will benefit you later.

Please read up on NGINX, there is no shortcut to learning.

Short answer: Find your sites conf file and add it in there. 

https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04

/etc/nginx/sites-available/example.com

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                try_files $uri $uri/ =404;
        }
}
Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

To report a bug, please create a new issue on GitHub or ask a question here with the bug tag.
Webinoly Support Paypal Donations

PayPal · GitHub Sponsors · Bitcoin

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.

...