{"id":4775,"date":"2023-01-07T08:21:35","date_gmt":"2023-01-07T07:21:35","guid":{"rendered":"https:\/\/ekiwi.de\/?p=4775"},"modified":"2023-01-07T08:23:03","modified_gmt":"2023-01-07T07:23:03","slug":"apache-activate-deactivate-remove-websites-and-configurations","status":"publish","type":"post","link":"https:\/\/ekiwi.de\/en\/index.php\/4775\/apache-activate-deactivate-remove-websites-and-configurations\/","title":{"rendered":"Apache: Activate \/ deactivate \/ remove websites and configurations"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of content<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ekiwi.de\/en\/index.php\/4775\/apache-activate-deactivate-remove-websites-and-configurations\/#Display_the_configurations\" >Display the configurations<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ekiwi.de\/en\/index.php\/4775\/apache-activate-deactivate-remove-websites-and-configurations\/#Enable_site_Enable_configuration\" >Enable site \/ Enable configuration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ekiwi.de\/en\/index.php\/4775\/apache-activate-deactivate-remove-websites-and-configurations\/#Disable_site_disable_configuration\" >Disable site \/ disable configuration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ekiwi.de\/en\/index.php\/4775\/apache-activate-deactivate-remove-websites-and-configurations\/#Restart_server\" >Restart server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ekiwi.de\/en\/index.php\/4775\/apache-activate-deactivate-remove-websites-and-configurations\/#Remove_configuration\" >Remove configuration<\/a><\/li><\/ul><\/nav><\/div>\n<p>Activate, deactivate and remove Apache websites and configurations. This is how it works.<\/p>\n<p><!--more--><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Display_the_configurations\"><\/span>Display the configurations<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Let&#8217;s start by displaying the virtual hosts, or the configurations, which are set up. These are located in the folder &#8220;<code>\/etc\/apache2\/sites-available\/<\/code>&#8220;. These configurations are available, but not necessarily active.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2023\/01\/server_1.png\" alt=\"\" width=\"696\" height=\"216\" class=\"alignnone size-full wp-image-4771\" srcset=\"\/wp-content\/uploads\/2023\/01\/server_1.png 696w, \/wp-content\/uploads\/2023\/01\/server_1-300x93.png 300w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/p>\n<p>The active configurations are located in the folder &#8220;<code>\/etc\/apache2\/sites-enabled\/<\/code>&#8220;, whereby &#8220;located&#8221; is the wrong word. Here, links are created in the file system to the configuration in the folder &#8220;<code>sites-available<\/code>&#8220;. Thus, virtual hosts can be activated or deactivated without removing the actual configuration.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Enable_site_Enable_configuration\"><\/span>Enable site \/ Enable configuration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The activation of a configuration is done with the command &#8220;<code>a2ensite<\/code>&#8220;. It is possible that there are multiple configurations for a virtual host. In our example, there are two files, one with the normal &#8220;http&#8221; configuration and one with &#8220;https&#8221;.<\/p>\n<p>First we change to the configuration folder with &#8220;<code>cd \/etc\/apache2\/sites-available<\/code>&#8220;.<\/p>\n<pre>\r\na2ensite server.andydunkel.net.conf\r\na2ensite server.andydunkel.net-le-ssl.conf\r\n<\/pre>\n<p>After executing the command, with sudo rights, the configuration is activated.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Disable_site_disable_configuration\"><\/span>Disable site \/ disable configuration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>For deactivation, there is the command &#8220;<code>a2dissite<\/code>&#8221; The operation is analogous.<\/p>\n<pre>\r\na2dissite server.andydunkel.net.conf\r\na2dissite server.andydunkel.net-le-ssl.conf\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2023\/01\/server_2.png\" alt=\"\" width=\"798\" height=\"86\" class=\"alignnone size-full wp-image-4773\" srcset=\"\/wp-content\/uploads\/2023\/01\/server_2.png 798w, \/wp-content\/uploads\/2023\/01\/server_2-300x32.png 300w, \/wp-content\/uploads\/2023\/01\/server_2-768x83.png 768w\" sizes=\"auto, (max-width: 798px) 100vw, 798px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Restart_server\"><\/span>Restart server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The configuration is not immediately active, as the output of the command already suggests. To do this, we use one of the following commands to re-read the configuration and restart the web server.<\/p>\n<pre>\r\nsudo systemctl reload apache2\r\nsudo systemctl restart apache2\r\nsudo service apache2 restart\r\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Remove_configuration\"><\/span>Remove configuration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To completely remove a configuration, we first disable it. Then we delete the configuration file.<\/p>\n<pre>\r\ncd \/etc\/apache2\/sites-available\r\nrm server.andydunkel.net.conf\r\nrm server.andydunkel.net-le-ssl.conf\r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>Activate, deactivate and remove Apache websites and configurations. This is how it works.<\/p>\n","protected":false},"author":1,"featured_media":3089,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[884],"tags":[918,919,917],"class_list":["post-4775","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server-en","tag-apache-en","tag-linux-en","tag-server-en"],"_links":{"self":[{"href":"https:\/\/ekiwi.de\/en\/index.php\/wp-json\/wp\/v2\/posts\/4775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi.de\/en\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi.de\/en\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/en\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/en\/index.php\/wp-json\/wp\/v2\/comments?post=4775"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi.de\/en\/index.php\/wp-json\/wp\/v2\/posts\/4775\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/en\/index.php\/wp-json\/wp\/v2\/media\/3089"}],"wp:attachment":[{"href":"https:\/\/ekiwi.de\/en\/index.php\/wp-json\/wp\/v2\/media?parent=4775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi.de\/en\/index.php\/wp-json\/wp\/v2\/categories?post=4775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi.de\/en\/index.php\/wp-json\/wp\/v2\/tags?post=4775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}