{"id":8361,"date":"2023-03-13T12:45:11","date_gmt":"2023-03-13T12:45:11","guid":{"rendered":"https:\/\/www.bodhost.com\/kb\/?p=8361"},"modified":"2026-02-26T14:02:44","modified_gmt":"2026-02-26T14:02:44","slug":"using-apache-adding-config-directives-to-all-virtual-hosts-on-server","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/","title":{"rendered":"Using Apache: Adding Config Directives to All Virtual Hosts on Server"},"content":{"rendered":"\r\n<p>In this article, we&#8217;ll go through how to utilize Apache, adding configuration directives to all virtual hosts on the server.<\/p>\r\n\r\n\r\n\r\n<p>Some contexts are related to Apache configuration directives. Apache configuration directives are linked to certain situations. The context in which a directive appears determines where it appears. You may get more information about the Apache documentation here.<\/p>\r\n\r\n\r\n\r\n<p>Several Apache directives must be specified inside the virtual host context. You must use the procedure described in this article if you wish to add a directive to the virtual host context.<\/p>\r\n\r\n\r\n\r\n<p>Follow the Procedure To add your own directives to every virtual host on the server.<\/p>\r\n\r\n\r\n\r\n<p>Use the following procedures to change all virtual hosts (both ports 80 and 443):<\/p>\r\n\r\n\r\n\r\n<p>Now use SSH to connect to the server as the root user.<\/p>\r\n\r\n\r\n\r\n<p><strong>1. Execute the instructions below:<\/strong><\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>mkdir -pv\u00a0\/etc\/apache2\/conf.d\/userdata\/<br \/>\r\ntouch\u00a0\/etc\/apache2\/conf.d\/userdata\/include.conf<\/code><\/pre>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Include the Apache directives you want to use. conf<\/li>\r\n\r\n\r\n\r\n<li>Restart Apache and rebuild the configuration.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>\/scripts\/rebuildhttpdconf<\/code><\/pre>\r\n\r\n\r\n\r\n<p>Now, Restart Apache<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>\/scripts\/restartsrv_apache<\/code><\/pre>\r\n\r\n\r\n\r\n<p>Write the following To change virtual hosts for ports 80 and 443 separately.<\/p>\r\n\r\n\r\n\r\n<p>For Port 80<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>\/etc\/apache2\/conf.d\/userdata\/std\/include.conf<\/code><\/pre>\r\n\r\n\r\n\r\n<p>For Port 443<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>\/etc\/apache2\/conf.d\/userdata\/ssl\/includ.conf<\/code><\/pre>\r\n\r\n\r\n\r\n<p>We hope that you now have a good understanding of How to use Apache Adding configuration directives to all virtual hosts on the server. If you continue to have problems with the protocol outlined above, please contact the <strong><a href=\"https:\/\/www.bodhost.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">bodHOST <\/a><\/strong>Team for constructive assistance 24\/7 days.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-verse\"><strong>Read Also: <a href=\"https:\/\/www.bodhost.com\/kb\/how-to-change-the-apache-port\/\" target=\"_blank\" rel=\"noreferrer noopener\">How To Change The Apache Port<\/a><\/strong><\/pre>\r\n","protected":false},"excerpt":{"rendered":"<p>In this article, we&#8217;ll go through how to utilize Apache, adding configuration directives to all virtual hosts on the server. Some contexts are related to Apache configuration directives. Apache configuration directives are linked to certain situations. The context in which a directive appears determines where it appears. You may get more information about the Apache [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[894],"tags":[895,1399,1152],"class_list":["post-8361","post","type-post","status-publish","format-standard","hentry","category-apache-web-server","tag-apache","tag-configuration","tag-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using Apache: How to Add Config Directives to All Virtual Hosts<\/title>\n<meta name=\"description\" content=\"In this article, we have explained Using Apache: Adding Config Directives to All Virtual Hosts on Server.\" \/>\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.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Apache: How to Add Config Directives to All Virtual Hosts\" \/>\n<meta property=\"og:description\" content=\"In this article, we have explained Using Apache: Adding Config Directives to All Virtual Hosts on Server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-13T12:45:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:02:44+00:00\" \/>\n<meta name=\"author\" content=\"Vincer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vincer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\\\/\"},\"author\":{\"name\":\"Vincer\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/f3852d74aeac480763235276b5faddd0\"},\"headline\":\"Using Apache: Adding Config Directives to All Virtual Hosts on Server\",\"datePublished\":\"2023-03-13T12:45:11+00:00\",\"dateModified\":\"2026-02-26T14:02:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\\\/\"},\"wordCount\":221,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"apache\",\"Configuration\",\"Server\"],\"articleSection\":[\"Apache Web server\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\\\/\",\"name\":\"Using Apache: How to Add Config Directives to All Virtual Hosts\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2023-03-13T12:45:11+00:00\",\"dateModified\":\"2026-02-26T14:02:44+00:00\",\"description\":\"In this article, we have explained Using Apache: Adding Config Directives to All Virtual Hosts on Server.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Apache Web server\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/apache-web-server\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Apache: Adding Config Directives to All Virtual Hosts on Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/f3852d74aeac480763235276b5faddd0\",\"name\":\"Vincer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g\",\"caption\":\"Vincer\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/vinayak\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Apache: How to Add Config Directives to All Virtual Hosts","description":"In this article, we have explained Using Apache: Adding Config Directives to All Virtual Hosts on Server.","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.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/","og_locale":"en_US","og_type":"article","og_title":"Using Apache: How to Add Config Directives to All Virtual Hosts","og_description":"In this article, we have explained Using Apache: Adding Config Directives to All Virtual Hosts on Server.","og_url":"https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2023-03-13T12:45:11+00:00","article_modified_time":"2026-02-26T14:02:44+00:00","author":"Vincer","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Vincer","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/"},"author":{"name":"Vincer","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/f3852d74aeac480763235276b5faddd0"},"headline":"Using Apache: Adding Config Directives to All Virtual Hosts on Server","datePublished":"2023-03-13T12:45:11+00:00","dateModified":"2026-02-26T14:02:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/"},"wordCount":221,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["apache","Configuration","Server"],"articleSection":["Apache Web server"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/","url":"https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/","name":"Using Apache: How to Add Config Directives to All Virtual Hosts","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2023-03-13T12:45:11+00:00","dateModified":"2026-02-26T14:02:44+00:00","description":"In this article, we have explained Using Apache: Adding Config Directives to All Virtual Hosts on Server.","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/using-apache-adding-config-directives-to-all-virtual-hosts-on-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Apache Web server","item":"https:\/\/www.bodhost.com\/kb\/category\/apache-web-server\/"},{"@type":"ListItem","position":2,"name":"Using Apache: Adding Config Directives to All Virtual Hosts on Server"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/f3852d74aeac480763235276b5faddd0","name":"Vincer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bb5079f76e01aaa97b2ffcb7a562292482693b395aba4a4214c98f006c07d352?s=96&d=mm&r=g","caption":"Vincer"},"url":"https:\/\/www.bodhost.com\/kb\/author\/vinayak\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/8361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=8361"}],"version-history":[{"count":10,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/8361\/revisions"}],"predecessor-version":[{"id":13578,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/8361\/revisions\/13578"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=8361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=8361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=8361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}