Applicable to:
- Plesk Onyx 17.5 for Linux
- Plesk for Linux
Question
There is a file
/var/www/vhosts/httpdocs/testdir/file.txt
How to prohibit access from a browser to this file(e.g.
http//example.com/testdir/file.txt
)?
Answer
In case static files are served by Apache ( Serve static files directly by nginx option is unchecked in Plesk > Domains > example.com > Apache & nginx Settings ):
-
Log in to Plesk server using SSH .
-
Create a file
/var/www/vhosts/httpdocs/testdir/.htaccess
:# vi /var/www/vhosts/example.com.httpdocs/testdir/.htaccess
-
Add the following directives in the created file:
CONFIG_TEXT: <Files "file.txt">
Order Allow,Deny
Deny from all
</Files>
In case static files are served by Nginx ( Serve static files directly by nginx option is checked in Plesk > Domains > example.com > Apache & nginx Settings ):
-
Go to Plesk > Domains > example.com > Apache & nginx Settings.
-
Add the following directives to Additional nginx directives field:
CONFIG_TEXT: location = /testdir/file.txt {
deny all;
}
Comments
0 comments
Please sign in to leave a comment.