{"id":2179,"date":"2017-10-13T19:59:34","date_gmt":"2017-10-13T14:29:34","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=2179"},"modified":"2017-10-16T16:06:50","modified_gmt":"2017-10-16T10:36:50","slug":"add-custom-virtualhost-configurationapache-2-4","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/add-custom-virtualhost-configurationapache-2-4\/","title":{"rendered":"Add a custom virtualhost configuration on cpanel |Apache 2.4"},"content":{"rendered":"<h3>Add a custom virtualhost configuration on cpanel |Apache 2.4<\/h3>\n<p><strong>Date posted: 13-10-2017<\/strong><\/p>\n<p>Latest cPanel comes with apache 2.4 and in this post we will explain on how to create custom vhost configuration.<\/p>\n<h4>Assumption:<\/h4>\n<ol>\n<li>cPanel server<\/li>\n<li>Server Access<\/li>\n<li>Assuming that, we will create a custom configuration for the domain &#8216;domain.tld&#8217; and the username is &#8216;cusername&#8217;<\/li>\n<\/ol>\n<h4>Implementation:<\/h4>\n<p>Create a directory for the domain custom virtual host configuration. This custom configuration is for https section.<\/p>\n<p><code>mkdir -p \/etc\/apache2\/conf.d\/userdata\/ssl\/2_4\/cusername\/domain.tld\/<\/code><\/p>\n<p>For http configuration, create a directory.<\/p>\n<p><code>mkdir -p \/etc\/apache2\/conf.d\/userdata\/std\/2_4\/cusername\/domain.tld\/<\/code><\/p>\n<p>Now, create a configuration file and append the changes in it.<\/p>\n<p><code>vi\u00a0\/etc\/apache2\/conf.d\/userdata\/ssl\/2_4\/cusername\/domain.tld\/domaintld.conf<\/code><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">DirectoryIndex home.html<\/pre>\n<p>In the above example, we just added DirectoryIndex in it. You can add more configuration changes in this file.<\/p>\n<p>Similarly, we will be adding the changes on http virtualhost configuration.<\/p>\n<p><code>vi\u00a0\/etc\/apache2\/conf.d\/userdata\/std\/2_4\/cusername\/domain.tld\/domaintld.conf<\/code><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">DirectoryIndex home.html<\/pre>\n<p>Rebuild httpd configuration.<\/p>\n<p><code>\/usr\/local\/cpanel\/scripts\/rebuildhttpdconf<\/code><\/p>\n<p>After, we executed the above command, the following lines will be uncommented automatically.<\/p>\n<blockquote><p>Include &#8220;\/etc\/apache2\/conf.d\/userdata\/ssl\/2_4\/cusername\/domain.tld\/*.conf&#8221;<\/p>\n<p>Include &#8220;\/etc\/apache2\/conf.d\/userdata\/2_4\/cusername\/domain.tld\/*.conf&#8221;<\/p><\/blockquote>\n<p>Restart the httpd service using scripts<\/p>\n<p><code>\/usr\/local\/cpanel\/scripts\/restartsrv_httpd<\/code><\/p>\n<p>Now, the changes automatically applied after restart the service.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Add a custom virtualhost configuration on cpanel |Apache 2.4 Date posted: 13-10-2017 Latest cPanel comes with apache 2.4 and in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","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":"","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":"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":"","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-4)","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-4)","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-4)","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_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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[263,370],"class_list":["post-2179","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-cpanel","tag-virtualhost","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-z9","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2179"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2179\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}