{"id":1574,"date":"2013-08-04T18:30:44","date_gmt":"2013-08-05T01:30:44","guid":{"rendered":"http:\/\/www.virendrachandak.com\/techtalk\/\/?p=1574"},"modified":"2023-06-07T11:35:15","modified_gmt":"2023-06-07T18:35:15","slug":"how-to-hide-nginx-version-number-in-headers-and-errors-pages","status":"publish","type":"post","link":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/","title":{"rendered":"How to hide Nginx version number in headers and errors pages"},"content":{"rendered":"<p>In default Nginx configuration, the server sends HTTP Header with the information of Nginx version number of the Server. The HTTP response header \u201cServer\u201d displays the version number of the server. This information can be used by hackers to try to exploit any vulnerabilities in the Nginx, specially if you are running an older version with known vulnerabilities.<\/p>\n<p>Sample HTTP Response Header:<\/p>\n<pre class=\"brush: plain; highlight: [2]; title: ; notranslate\" title=\"\">\r\nHTTP\/1.1 200 OK\r\nServer: nginx\/1.2.6 (Ubuntu)\r\nDate: Wed, 31 Jul 2013 19:47:33 GMT\r\n<\/pre>\n<p><!--more--><\/p>\n<div><strong>Note<\/strong>: This is just one way to identify the details. Also, even if this information is not available hackers might still try to hack it using other ways.<\/div>\n<p>There is an easy way to hide the Nginx version number from the HTTP headers. By setting the &#8220;<strong>server_tokens<\/strong>&#8221; variables in your nginx.conf file the server information would not longer be added to the HTTP headers. Use the following lines in you nginx.conf file. Make sure to back up you file before editing so that in case something goes wrong you can easily revert. After making the changes restart your nginx (<strong>Note<\/strong>: Doing so will take your site down, if it runs only on 1 server).<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\nserver_tokens off;\r\n<\/pre>\n<div>After using the above directives the HTTP headers will look similar to this:<\/div>\n<pre class=\"brush: plain; highlight: [2]; title: ; notranslate\" title=\"\">\r\nHTTP\/1.1 200 OK\r\nServer: nginx\r\nDate: Wed, 31 Jul 2013 19:49:15 GMT\r\n<\/pre>\n<div>\n<div>\n<span style=\"text-decoration: underline;\"><strong>Note<\/strong><\/span>: Make these changes in your server only if you are sure you know you can do them. If you make a mistake in the nginx.conf file, your site won&#8217;t work. So be very careful when making these changes. Also, it is always good to take a backup of the existing file before making any changes, in case you want to revert.\n<\/div>\n<div style=\"padding-top:15px;\">\n<strong>Related Link<\/strong>:<\/p>\n<ul>\n<li><a title=\"Nginx HttpCoreModule - server_tokens\" href=\"https:\/\/nginx.org\/en\/docs\/http\/ngx_http_core_module.html#server_tokens\" rel=\"external nofollow noopener\" target=\"_blank\">Nginx HttpCoreModule &#8211; server_tokens<\/a><\/li>\n<\/ul>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In default Nginx configuration, the server sends HTTP Header with the information of Nginx version number of the Server. The HTTP response header \u201cServer\u201d displays the version number of the server. This information can be used by hackers to try to exploit any vulnerabilities in the Nginx, specially if you are running an older version [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6],"tags":[114,120,124],"class_list":["post-1574","post","type-post","status-publish","format-standard","hentry","category-server-configuration","tag-http-header","tag-nginx","tag-snippets"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to hide Nginx version number in headers and errors pages - Virendra&#039;s TechTalk<\/title>\n<meta name=\"description\" content=\"Nginx server by default sends its version number in HTTP headers. Nginx version number can be removed by changing the server_tokens configuration variable.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to hide Nginx version number in headers and errors pages - Virendra&#039;s TechTalk\" \/>\n<meta property=\"og:description\" content=\"Nginx server by default sends its version number in HTTP headers. Nginx version number can be removed by changing the server_tokens configuration variable.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/\" \/>\n<meta property=\"og:site_name\" content=\"Virendra&#039;s TechTalk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:published_time\" content=\"2013-08-05T01:30:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-07T18:35:15+00:00\" \/>\n<meta name=\"author\" content=\"Virendra Chandak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:site\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virendra Chandak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/\"},\"author\":{\"name\":\"Virendra Chandak\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\"},\"headline\":\"How to hide Nginx version number in headers and errors pages\",\"datePublished\":\"2013-08-05T01:30:44+00:00\",\"dateModified\":\"2023-06-07T18:35:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/\"},\"wordCount\":303,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\"},\"keywords\":[\"HTTP Header\",\"Nginx\",\"snippets\"],\"articleSection\":[\"Server Configuration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/\",\"url\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/\",\"name\":\"How to hide Nginx version number in headers and errors pages - Virendra&#039;s TechTalk\",\"isPartOf\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#website\"},\"datePublished\":\"2013-08-05T01:30:44+00:00\",\"dateModified\":\"2023-06-07T18:35:15+00:00\",\"description\":\"Nginx server by default sends its version number in HTTP headers. Nginx version number can be removed by changing the server_tokens configuration variable.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TechTalk\",\"item\":\"https:\/\/www.virendrachandak.com\/techtalk\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Server Configuration\",\"item\":\"https:\/\/www.virendrachandak.com\/techtalk\/category\/server-configuration\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to hide Nginx version number in headers and errors pages\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#website\",\"url\":\"https:\/\/www.virendrachandak.com\/techtalk\/\",\"name\":\"Virendra's TechTalk\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\",\"name\":\"Virendra Chandak\",\"logo\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/www.virendrachandak.com\",\"https:\/\/www.facebook.com\/virendrachandak\",\"https:\/\/www.linkedin.com\/in\/virendrachandak\/\",\"https:\/\/x.com\/virendrachandak\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to hide Nginx version number in headers and errors pages - Virendra&#039;s TechTalk","description":"Nginx server by default sends its version number in HTTP headers. Nginx version number can be removed by changing the server_tokens configuration variable.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/","og_locale":"en_US","og_type":"article","og_title":"How to hide Nginx version number in headers and errors pages - Virendra&#039;s TechTalk","og_description":"Nginx server by default sends its version number in HTTP headers. Nginx version number can be removed by changing the server_tokens configuration variable.","og_url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/","og_site_name":"Virendra&#039;s TechTalk","article_publisher":"https:\/\/www.facebook.com\/virendrachandak","article_author":"https:\/\/www.facebook.com\/virendrachandak","article_published_time":"2013-08-05T01:30:44+00:00","article_modified_time":"2023-06-07T18:35:15+00:00","author":"Virendra Chandak","twitter_card":"summary_large_image","twitter_creator":"@virendrachandak","twitter_site":"@virendrachandak","twitter_misc":{"Written by":"Virendra Chandak","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/#article","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/"},"author":{"name":"Virendra Chandak","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"headline":"How to hide Nginx version number in headers and errors pages","datePublished":"2013-08-05T01:30:44+00:00","dateModified":"2023-06-07T18:35:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/"},"wordCount":303,"commentCount":2,"publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"keywords":["HTTP Header","Nginx","snippets"],"articleSection":["Server Configuration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/","url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/","name":"How to hide Nginx version number in headers and errors pages - Virendra&#039;s TechTalk","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website"},"datePublished":"2013-08-05T01:30:44+00:00","dateModified":"2023-06-07T18:35:15+00:00","description":"Nginx server by default sends its version number in HTTP headers. Nginx version number can be removed by changing the server_tokens configuration variable.","breadcrumb":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-nginx-version-number-in-headers-and-errors-pages\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"TechTalk","item":"https:\/\/www.virendrachandak.com\/techtalk\/"},{"@type":"ListItem","position":2,"name":"Server Configuration","item":"https:\/\/www.virendrachandak.com\/techtalk\/category\/server-configuration\/"},{"@type":"ListItem","position":3,"name":"How to hide Nginx version number in headers and errors pages"}]},{"@type":"WebSite","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website","url":"https:\/\/www.virendrachandak.com\/techtalk\/","name":"Virendra's TechTalk","description":"","publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17","name":"Virendra Chandak","logo":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.virendrachandak.com","https:\/\/www.facebook.com\/virendrachandak","https:\/\/www.linkedin.com\/in\/virendrachandak\/","https:\/\/x.com\/virendrachandak"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2vTtQ-po","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/comments?post=1574"}],"version-history":[{"count":1,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1574\/revisions"}],"predecessor-version":[{"id":2594,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1574\/revisions\/2594"}],"wp:attachment":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/media?parent=1574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/categories?post=1574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/tags?post=1574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}