Jump to content

Remove Nginx Server Header - Linux App Service (PHP 8.x blessed image)

Featured Replies

Posted

We can follow the below steps to remove the Server header from HTTP response for PHP 8.x apps on Linux App Service (which uses Nginx server) -

 

We will be following the steps described here to change the configurations of Nginx: NGINX Rewrite Rules for Azure App Service Linux PHP 8.x

 

#create a copy of the default configurations

cp /etc/nginx/sites-available/default /home/site/default

 

#add the following properties in the copied file /home/site/default

 

server_tokens off;

more_clear_headers Server;

 

mediumvv2px400.png.df0619c45da844511a226d9d67ad3ec5.png

 

#create a startup script /home/site/start.sh (feel free to rename it)

 

#!/bin/bash

 

cp /home/site/default /etc/nginx/sites-available/default

service nginx reload

 

mediumvv2px400.png.a5a2a2bfadea88279759a7961f206e04.png

 

 

#Add a startup command on the WebApp and wait for it to restart.

 

#We can using the cURL command:

curl -I Microsoft Azure App Service - Welcome

 

[-i, --include Include protocol response headers in the output]

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...