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

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

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: https://azureossd.github.io/2021/09/02/php-8-rewrite-rule/index.html
 
#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;
 
gaukazure_0-1677141623564.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
 
gaukazure_1-1677141623565.png

 

#Add a startup command on the WebApp and wait for it to restart.
 
#We can using the cURL command:
 
[-i, --include Include protocol response headers in the output]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.