banner



How To Remove Nginx From My Phone

Cover image for How to remove Nginx server  version and  name.

shiva kumar

How to remove Nginx server version and name.

Hackers by and large exploit, when they know server proper name and its version. We tin reduce the chances commencement by hiding the name and version of the Nginx. Secondly, by regularly updating the tools we use.
This quick post will guide yous on renaming the Nginx server proper noun and remove version from the headers
If y'all haven't install Nginx or you lot dont know how to install Nginx in a ubuntu motorcar yous can follow this tutorial

You tin cheque if the server is running by using below command

                sudo service nginx status                              

Enter fullscreen manner Exit fullscreen mode

Let's see when request the server, what we become in response header

                ubuntu@ip-172-31-37-234:~$ curl -I localhost  HTTP/1.1 200 OK Server: nginx/1.18.0 (Ubuntu) Appointment: Tue, 22 Feb 2022 xx:57:32 GMT Content-Type: text/html Content-Length: 612 Final-Modified: Tue, 22 Feb 2022 20:56:10 GMT Connexion: keep-live ETag: "62154dea-264" Have-Ranges: bytes                              

Enter fullscreen mode Exit fullscreen mode

To rename the default server we demand a directive called more_set_headers just this doesn't comes default with Nginx we need to install a dynamic module called headers-more-nginx-module

If y'all have installed nginx ubuntu package, you need download the aforementioned version of Nginx already installed. This demand to be done to compile the dynamic module.
Lets download and unzip the nginx

                wget http://nginx.org/download/nginx-1.18.0.tar.gz  tar -xvzf nginx-1.eighteen.0.tar.gz                              

Enter fullscreen style Exit fullscreen mode

Since have already installed nginx we tin can view the listing of modules installed. You can do that by using

                nginx -5   nginx version: nginx/one.xviii.0 (Ubuntu) built with OpenSSL i.i.1f  31 Mar 2020 TLS SNI back up enabled configure arguments: --with-cc-opt='-grand -O2 -fdebug-prefix-map=/build/nginx-BUo7Uw/nginx-1.18.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,at present -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-customer-body-temp-path=/var/lib/nginx/trunk --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_sub_module                              

Enter fullscreen mode Get out fullscreen style

Lets re-create the output and pass them when recompiling the nginx-with-headers-more module

Allow's download and install the nginx-with-headers-more module

                git clone https://github.com/openresty/headers-more than-nginx-module.git   cd nginx-i.18.0/  ./configure  --add-dynamic-module=/home/ubuntu/headers-more-nginx-module  <--with... paste the previously installed module from above nginx -5 command>  brand                              

Enter fullscreen mode Get out fullscreen mode

Once its done we have module in /home/ubuntu/nginx-1.18.0/objs directory. Nosotros need to motion this to existing installed nginx modules directory

                sudo cp ngx_http_headers_more_filter_module.and so /usr/lib/nginx/modules/                              

Enter fullscreen mode Go out fullscreen mode

Now the headers-more than-nginx-module is bachelor to use. Go to the nginx.conf file include the installed module and add both directives to http block

                user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; load_module modules/ngx_http_headers_more_filter_module.so;  events {         worker_connections 768; }  http {         sendfile on;         tcp_nopush on;         types_hash_max_size 2048;         server_tokens off;         more_set_headers 'Server: Gandalf';  #Gandalf will protect your server from balrog. }                              

Enter fullscreen mode Exit fullscreen mode

Restart the nginx server

                sudo service nginx restart                              

Enter fullscreen mode Leave fullscreen way

Let check once more the response header

                curl -I localhost HTTP/1.1 200 OK Date: Tue, 22 Feb 2022 21:57:08 GMT Content-Blazon: text/html Content-Length: 612 Final-Modified: Tue, 22 Feb 2022 20:56:10 GMT Connectedness: proceed-alive ETag: "62154dea-264" Server: Gandalf Accept-Ranges: bytes                              

Enter fullscreen mode Exit fullscreen way

If you desire consummate remove the server name, laissez passer server name empty like this in nginx.conf file

                more_set_headers 'Server: ';                              

Enter fullscreen style Go out fullscreen manner

Output

                                  curl -I localhost HTTP/1.one 200 OK Appointment: Tue, 22 Feb 2022 21:58:02 GMT Content-Type: text/html Content-Length: 612 Last-Modified: Tue, 22 Feb 2022 twenty:56:ten GMT Connection: continue-live ETag: "62154dea-264" Accept-Ranges: bytes                              

Enter fullscreen style Exit fullscreen style

Congratulations! You have successfully renamed the server proper name and removed the version.
Hope this post was helpful. If you enjoyed this post, share it.

How To Remove Nginx From My Phone,

Source: https://dev.to/rshiva/how-to-nginx-remove-version-and-name-50ek

Posted by: arredondointoommand.blogspot.com

0 Response to "How To Remove Nginx From My Phone"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel