NGINX PHP 8 App Service - Deny folder and file type access

HL 1 Reputation point
2021-12-12T09:02:46.203+00:00

I understand that one cannot change nginx.config as a method to limit access to folders or file types. (Similar to .htaccess for Apache).

What is the work around to limit folder and file type access for the NGINX PHP 8 App Service on Azure?

HL

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2021-12-16T12:36:41.383+00:00

    @HL , Firstly, apologies for the delayed response.

    • Yes, Linux PHP v8 images are defaulted to nginx/php-fpm. So you will not need .htaccess, but rewrite rules to mimic .htaccess.
    • While the App Service platform provides a remote file share for individual apps, the underlying implementation (being a PAAS solution) doesn’t provide file and directory operations.
      So, there isn’t a way to alter specific file/directory permissions with the chown command.

    You cannot change permissions on the /home directory when persisting storage.
    You cannot change these permissions, even if you attempt to do so from an initialization script or from SSH.
    Checkout this document for more info.

    Additionally,

    • You may take a look at this blog to know - Convert Apache Rewrite Rules to NGINX Rewrite Rules | NGINX

    You can configure using startup command: Azure App Service on Linux FAQ


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.