<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technology Archives -</title>
	<atom:link href="https://codekosh.com/category/technology/feed/" rel="self" type="application/rss+xml" />
	<link>https://codekosh.com/category/technology/</link>
	<description></description>
	<lastBuildDate>Mon, 04 Aug 2025 04:02:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://codekosh.com/wp-content/uploads/2025/08/Fav-ico-150x150.jpg</url>
	<title>Technology Archives -</title>
	<link>https://codekosh.com/category/technology/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Create a Subdomain in DigitalOcean</title>
		<link>https://codekosh.com/how-to-create-a-subdomain-in-digitalocean/</link>
					<comments>https://codekosh.com/how-to-create-a-subdomain-in-digitalocean/#respond</comments>
		
		<dc:creator><![CDATA[Shubham Rana]]></dc:creator>
		<pubDate>Mon, 13 May 2024 05:54:14 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<guid isPermaLink="false">https://codekosh.com/?p=512</guid>

					<description><![CDATA[<p>While using a cloud server, It always very difficult to set up a domain or sub-domain in the digital ocean, [&#8230;]</p>
<p>The post <a href="https://codekosh.com/how-to-create-a-subdomain-in-digitalocean/">How to Create a Subdomain in DigitalOcean</a> appeared first on <a href="https://codekosh.com"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="top-content">While using a cloud server, It always very difficult to set up a domain or sub-domain in the digital ocean, Google Cloud and AWS. In given few steps I will explain to you how easily you can set up a sub-domain with your active domain in digital Ocean server.</p>
<h2>Setup Sub – Domain in Digital Ocean:</h2>
<ol>
<li style="list-style-type: none;">
<ol>
<li>Login to your digital ocean account.</li>
<li>Click on the domain – e.g I want to make portfolio.codekosh.com – so I m click on codekosh.com from added domain list. As I have marked in reg.<br />
<img fetchpriority="high" decoding="async" class="alignnone wp-image-523" src="https://codekosh.com/wp-content/uploads/2024/05/select-a-domain-from-domain-list-300x118.jpg" alt="" width="516" height="203" /></li>
<li>Now you need to add the &#8220;A&#8221; record and CNAME record.<br />
A record e.g: <strong>portfolio and </strong>CNMAE <strong>www.portfolio</strong><strong> </strong>and point to your droplet.<img decoding="async" class=" wp-image-527" src="https://codekosh.com/wp-content/uploads/2024/05/create-your-a-record-300x154.jpg" alt="Create your A record" width="516" height="265" /><br />
Create your <strong>CNAME </strong>record.<br />
<img decoding="async" class="alignnone wp-image-531" src="https://codekosh.com/wp-content/uploads/2024/05/create-your-cname-record-300x154.jpg" alt="" width="518" height="266" /></li>
</ol>
</li>
</ol>
<h2 class="HeadingStyles__StyledH1-sc-73f0758c-0 gOvywW TutorialTemplate___StyledHeading2-sc-64c15beb-1 kQEzBT">How To Set Up Apache Virtual Hosts on Ubuntu</h2>
<p>Setting up Apache virtual hosts on Ubuntu allows you to host multiple websites on a single server, each with its own domain or subdomain. This setup is particularly useful for web developers, businesses, or individuals who want to run multiple websites through domain and subdomain on the same server without conflicts. Here&#8217;s a comprehensive guide to walk you through the process by <a href="https://codekosh.com/development/how-to-create-a-subdomain-in-digitalocean/">codekosh.com.</a></p>
<h3>Step 1: Install Apache</h3>
<p>If Apache isn&#8217;t already installed on your Ubuntu server, you can install it using the following below commands.</p>
<pre><code>sudo apt update
sudo apt install apache2</code></pre>
<h3>Step 2 — Creating the Directory Structure</h3>
<p class="common">Step to create a directory structure that will hold the site data that you will be serving to visitors.</p>
<p class="common">Your document root, the top-level directory that Apache looks at to find content to serve, will be set to individual directories under the <strong>/var/www</strong> directory. You will create a directory here for each of the virtual hosts.</p>
<p class="common">Create a directory structure to store the website files for each virtual host. Within each of these directories, you will create a <strong>public_html</strong> directory. The <strong>public_html</strong> directory contains the content that will be served to your visitors.</p>
<p class="common">Use this command, with your own domain name, to create your directories.</p>
<pre>sudo mkdir -p /var/www/example.com/public_html</pre>
<p class="common">Replace example.com with your domain name.</p>
<h3>Step 3: Assign Permissions</h3>
<p class="common">You’ve created the directory structure for your files, but they are owned by the root user. If you want your regular user to be able to modify files in these web directories, you can change the ownership with this command.</p>
<pre>sudo chown -R $USER:$USER /var/www/example.com/public_html</pre>
<p class="common">The <strong>$USER</strong>&gt; variable will take the value of the user you are currently logged in as when you press ENTER in terminal. By doing this, the regular user now owns the <strong>public_html</strong> subdirectories where you will be storing your content.</p>
<p class="common">You should also modify your permissions to ensure that read access is permitted to the general web directory and all of the files and folders it contains so that the pages can be served correctly.</p>
<pre>sudo chmod -R 755 /var/www</pre>
<p class="common">Your web server now has the permissions it needs to serve content, and your user should be able to create content within the necessary folders. The next step is to create content for your virtual host sites.</p>
<h3>Step 4: Create Sample HTML File for host (Optional)</h3>
<p class="common">With your directory structure in place, you can start focusing on individual virtual host site and the content within that site. Start by creating an <strong>index.html</strong> page for your subdomain <strong>e.g <a href="https://codekosh.com/">portfolio.codekosh.com</a></strong>.</p>
<p class="common">Run this command to open and create the <strong>index.html</strong>. This example uses nano:</p>
<pre>nano /var/www/subdomain.example.com/public_html/index.html</pre>
<p class="common">You can add some html stuff in your <strong>index.html</strong> file to load the file in broswer by your subdomain.</p>
<p class="common">To save and close the <strong>index.html</strong> file in nano, start by pressing <strong>CTRL+X</strong>. Press <strong>Y</strong> when prompted to save the file, then press <strong>ENTER</strong> when you are finished to exit.</p>
<h3>Step 5: Creating New Virtual Host File</h3>
<p class="common">Apache on Ubuntu uses separate configuration files for each virtual host. You can create a new configuration file for each site in the <strong>/etc/apache2/sites-available/</strong> directory.</p>
<pre>sudo nano /etc/apache2/sites-available/subdomain.example.com.conf</pre>
<p class="common">Enter the following configuration in the config file:</p>
<pre>	
	    ServerAdmin admin@example.com
	    ServerName example.com
	    ServerAlias www.yoursubdomain.example.com
	    DocumentRoot /var/www/yoursubdomain.example.com/public_html
	    ErrorLog ${APACHE_LOG_DIR}/error.log
	    CustomLog ${APACHE_LOG_DIR}/access.log combined
	
</pre>
<p class="common">Save and close the file.</p>
<h3>Step 6: Enable the Virtual Host file</h3>
<p class="common">In previous step that we have created the virtual host file, you must enable them. Apache includes some tools that allow you to do this.</p>
<p class="common">You’ll be using the <strong>a2ensite</strong> tool to enable each of your sites.</p>
<pre>sudo a2ensite subdomain.example.com.conf</pre>
<p class="common">Before reloading your server, you have to disable the default site defined in <strong>000-default.conf</strong> by using the <strong>a2dissite</strong> command.</p>
<pre>sudo a2dissite 000-default.conf</pre>
<p class="common">Next, command to test the configuration errors:</p>
<pre>sudo apache2ctl configtest</pre>
<p class="common">When you are finished the above process, restart Apache to make these changes take effect.</p>
<pre>sudo systemctl restart apache2</pre>
<p class="common">Optionally, you can check the status of the server after all these changes with this below command.</p>
<pre>sudo systemctl status apache2</pre>
<p class="common">That&#8217;s it! You should now be able to access your website using the subdomain name you configured. Repeat steps 2-6 for each additional virtual host you want to set up.</p>
<p>The post <a href="https://codekosh.com/how-to-create-a-subdomain-in-digitalocean/">How to Create a Subdomain in DigitalOcean</a> appeared first on <a href="https://codekosh.com"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codekosh.com/how-to-create-a-subdomain-in-digitalocean/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
