<?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>webadmin Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/webadmin/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Thu, 13 Sep 2018 09:14:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.13</generator>
	<item>
		<title>How to configure an Apache Virtual host on Debian 9?</title>
		<link>https://www.osradar.com/how-to-configure-an-apache-virtual-host-on-debian-9/</link>
					<comments>https://www.osradar.com/how-to-configure-an-apache-virtual-host-on-debian-9/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Thu, 13 Sep 2018 09:14:09 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[learn]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[virtual hosts]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[webadmin]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=5712</guid>

					<description><![CDATA[<p>VirtualHost allows you to assign different websites across domains to the same IP address. They allow easy access to a PHP application hosted on an Apache web server through a simple domain. For this reason, is very used for web developers and system administrators. In this article, I will show you how to configure an Apache [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-configure-an-apache-virtual-host-on-debian-9/">How to configure an Apache Virtual host on Debian 9?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>VirtualHost</strong> allows you to assign different websites across domains to the same IP address. They allow easy access to a PHP application hosted on an <a href="https://httpd.apache.org/">Apache web server</a> through a simple domain. For this reason, is very<strong> used for web developers and system administrators. </strong>In this article, I will show you how to configure an Apache virtual host on Debian 9.</p>
<h2>0.What you need</h2>
<p>Before you start, you must have certain requirements for everything to work perfectly.</p>
<ul>
<li>Have, at least, a notion of how to <strong>use the command line interface</strong>.</li>
<li>A user who can use sudo.</li>
<li><strong>A desire to learn</strong>. Vital to acquire the knowledge that I will give you.</li>
<li>A computer with Debian 9 installed. Obvious, isn&#8217;t it?</li>
</ul>
<h2>1. Install Apache web server</h2>
<p>Generally, before you start installing and configuring a system, it is a good idea to perform a general system upgrade. With this, you will obtain the last security patches.</p>
<p>Open a terminal and run on it:</p>
<pre class="">:~$ sudo apt update &amp;&amp; sudo apt upgrade</pre>
<p>After you enter your password, the update process will begin. As a result, you will have an updated and secure system.</p>
<figure id="attachment_5713" aria-describedby="caption-attachment-5713" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5713" src="https://www.osradar.com/wp-content/uploads/2018/09/1-5.png" alt="1.- Upgrading the system" width="1368" height="747" srcset="https://www.osradar.com/wp-content/uploads/2018/09/1-5.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/1-5-300x164.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/1-5-768x419.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/1-5-1024x559.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/1-5-696x380.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/1-5-1068x583.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/1-5-769x420.png 769w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5713" class="wp-caption-text">1.- Upgrading the system</figcaption></figure>
<p>Now, you can install apache2 from the official Ubuntu repositories. Run:</p>
<pre class="">:~$ sudo apt install apache2</pre>
<figure id="attachment_5715" aria-describedby="caption-attachment-5715" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5715" src="https://www.osradar.com/wp-content/uploads/2018/09/2-5.png" alt="2.- Installing apache2 web server" width="1368" height="747" srcset="https://www.osradar.com/wp-content/uploads/2018/09/2-5.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/2-5-300x164.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/2-5-768x419.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/2-5-1024x559.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/2-5-696x380.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/2-5-1068x583.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/2-5-769x420.png 769w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5715" class="wp-caption-text">2.- Installing apache2 web server</figcaption></figure>
<p>As a result, you can now go to your browser and set the IP address of the server and you will see a page similar to this one. Open it.</p>
<p><strong>http://IP_server/</strong></p>
<figure id="attachment_5717" aria-describedby="caption-attachment-5717" style="width: 1365px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5717" src="https://www.osradar.com/wp-content/uploads/2018/09/3-5.png" alt="3.- Apache2 deafult page" width="1365" height="702" srcset="https://www.osradar.com/wp-content/uploads/2018/09/3-5.png 1365w, https://www.osradar.com/wp-content/uploads/2018/09/3-5-300x154.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/3-5-768x395.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/3-5-1024x527.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/3-5-696x358.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/3-5-1068x549.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/3-5-817x420.png 817w" sizes="(max-width: 1365px) 100vw, 1365px" /><figcaption id="caption-attachment-5717" class="wp-caption-text">3.- Apache2 default page</figcaption></figure>
<p>Good job. Apache is running smoothly on your computer.</p>
<h2>2.- Create web directory for each Apache virtual host</h2>
<p>In order to create a structure of efficient directories and that the Virtual hosts do not have problems, you must create a directory for each one of them. In this case, I will only create two virtual hosts. One called <strong>&#8220;osradar1.local&#8221;</strong> and other called <strong>&#8220;osradar2.local&#8221;</strong>.</p>
<p>Create the folders:</p>
<pre class="">:~$ sudo mkdir -p /var/www/html/osradar1.local/public_html
:~$ sudo mkdir -p /var/www/html/osradar1.local/public_html</pre>
<figure id="attachment_5718" aria-describedby="caption-attachment-5718" style="width: 1368px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5718" src="https://www.osradar.com/wp-content/uploads/2018/09/4-6.png" alt="4.- Creating the folders for virtual host" width="1368" height="747" srcset="https://www.osradar.com/wp-content/uploads/2018/09/4-6.png 1368w, https://www.osradar.com/wp-content/uploads/2018/09/4-6-300x164.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/4-6-768x419.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/4-6-1024x559.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/4-6-696x380.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/4-6-1068x583.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/4-6-769x420.png 769w" sizes="(max-width: 1368px) 100vw, 1368px" /><figcaption id="caption-attachment-5718" class="wp-caption-text">4.- Creating the folders for the virtual hosts</figcaption></figure>
<p>With this in mind proceeds to change the owner of them. Run,</p>
<pre class="">:~$ sudo chown -R $USER:$USER /var/www/html/osradar1.local/public_html
:~$ sudo chown -R $USER:$USER /var/www/html/osradar2.local/public_html</pre>
<figure id="attachment_5719" aria-describedby="caption-attachment-5719" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5719" src="https://www.osradar.com/wp-content/uploads/2018/09/5-5.png" alt="5.- Changing the folders owner" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/09/5-5.png 1366w, https://www.osradar.com/wp-content/uploads/2018/09/5-5-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/5-5-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/5-5-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/5-5-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/5-5-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/5-5-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-5719" class="wp-caption-text">5.- Changing the owner of the folders</figcaption></figure>
<p>Finally, change the permissions on the folders.</p>
<pre class="">:~$ sudo chmod -R 755 /var/www/html/</pre>
<figure id="attachment_5720" aria-describedby="caption-attachment-5720" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5720" src="https://www.osradar.com/wp-content/uploads/2018/09/6-5.png" alt="6.- Changing the permissions to the folders" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/09/6-5.png 1366w, https://www.osradar.com/wp-content/uploads/2018/09/6-5-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/6-5-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/6-5-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/6-5-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/6-5-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/6-5-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-5720" class="wp-caption-text">6.- Changing the permissions to the folders</figcaption></figure>
<p>Now, create an example index.html file, to check the operation.</p>
<pre class="">:~$ sudo nano /var/www/html/osradar1.local/public_html/index.html
:~$ sudo nano /var/www/html/osradar2.local/public_html/index.html</pre>
<p>For the first hosts (osradar1.local) in index.html, type this:</p>
<pre class="">&lt;html&gt;
&lt;header&gt;
&lt;title&gt;
osradar1.local website
&lt;/title&gt;
&lt;/header&gt;
&lt;body&gt;
This message is from osradar1.local website
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>And for the second host:</p>
<pre class="">&lt;html&gt;
&lt;header&gt;
&lt;title&gt;
osradar2.local website
&lt;/title&gt;
&lt;/header&gt;
&lt;body&gt;
This message is from osradar2.local website
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h2>3.- Create the configuration file for each host</h2>
<p>In this step, you must create the configuration files for each virtual host, but it&#8217;s not complicated because you can rely on the default configuration file.</p>
<p>In the first place, copy the default configuration file, and rename it for each virtual host.</p>
<pre class="">:~$ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/osradar1.local.conf
:~$ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/osradar2.local.conf</pre>
<figure id="attachment_5721" aria-describedby="caption-attachment-5721" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5721" src="https://www.osradar.com/wp-content/uploads/2018/09/7-6.png" alt="7.- Copying the apache default configuration file" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/09/7-6.png 1366w, https://www.osradar.com/wp-content/uploads/2018/09/7-6-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/7-6-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/7-6-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/7-6-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/7-6-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/7-6-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-5721" class="wp-caption-text">7.- Copying the apache default configuration file</figcaption></figure>
<p>Now, you must edit the files to adapt them to each virtual. For example, edit <code>osradar1.local.conf</code>.</p>
<pre class="">:~$ sudo nano /etc/apache2/sites-available/osradar1.local.conf</pre>
<p>In that file, you must modify ServerName, ServerAlias, ServerAdmin, and DocumentRoot.</p>
<figure id="attachment_5722" aria-describedby="caption-attachment-5722" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5722" src="https://www.osradar.com/wp-content/uploads/2018/09/8-4.png" alt="8.- Editing Virtual host configuration file" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/09/8-4.png 1366w, https://www.osradar.com/wp-content/uploads/2018/09/8-4-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/8-4-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/8-4-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/8-4-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/8-4-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/8-4-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-5722" class="wp-caption-text">8.- Editing Virtual host configuration file</figcaption></figure>
<p>Do the same for the other virtual host.</p>
<figure id="attachment_5723" aria-describedby="caption-attachment-5723" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5723" src="https://www.osradar.com/wp-content/uploads/2018/09/9-3.png" alt="9.- Editing the second file" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/09/9-3.png 1366w, https://www.osradar.com/wp-content/uploads/2018/09/9-3-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/9-3-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/9-3-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/9-3-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/9-3-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/9-3-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-5723" class="wp-caption-text">9.- Editing the second file</figcaption></figure>
<h2>4. Enabling configuration files</h2>
<p>Once the configuration files are ready, you must activate them. First, disable the default configuration file and then activate the newly created virtual hosts.</p>
<pre class="">:~$ sudo a2dissite 000-default.conf
:~$ sudo a2ensite osradar1.local.conf
:~$ sudo a2ensite osradar2.local.conf</pre>
<figure id="attachment_5724" aria-describedby="caption-attachment-5724" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5724" src="https://www.osradar.com/wp-content/uploads/2018/09/10-3.png" alt="10.- Enabling new configuration file for the virtual hosts" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/09/10-3.png 1366w, https://www.osradar.com/wp-content/uploads/2018/09/10-3-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/10-3-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/10-3-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/10-3-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/10-3-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/10-3-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-5724" class="wp-caption-text">10.- Enabling new configuration file for the virtual hosts</figcaption></figure>
<p>And it&#8217;s ready. Now let&#8217;s check that everything was successful. Restart apache2.</p>
<pre class="">:~$ sudo systemctl restart apache2</pre>
<h2>5.- Test the virtual hosts</h2>
<p>In the first place, edit the file <code>/etc/hosts</code> and add your IP with the names of the virtual hosts.</p>
<pre class="">:~$ sudo nano /etc/hosts</pre>
<figure id="attachment_5726" aria-describedby="caption-attachment-5726" style="width: 573px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5726" src="https://www.osradar.com/wp-content/uploads/2018/09/11-2.png" alt="11.- Editing hosts file&lt;" width="573" height="153" srcset="https://www.osradar.com/wp-content/uploads/2018/09/11-2.png 573w, https://www.osradar.com/wp-content/uploads/2018/09/11-2-300x80.png 300w" sizes="(max-width: 573px) 100vw, 573px" /><figcaption id="caption-attachment-5726" class="wp-caption-text">11.- Editing hosts file</figcaption></figure>
<p>Now, go to your web browser and enter your virtual host.</p>
<figure id="attachment_5728" aria-describedby="caption-attachment-5728" style="width: 1131px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5728" src="https://www.osradar.com/wp-content/uploads/2018/09/12-2.png" alt="12.- Checking the virtual hosts" width="1131" height="437" srcset="https://www.osradar.com/wp-content/uploads/2018/09/12-2.png 1131w, https://www.osradar.com/wp-content/uploads/2018/09/12-2-300x116.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/12-2-768x297.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/12-2-1024x396.png 1024w, https://www.osradar.com/wp-content/uploads/2018/09/12-2-696x269.png 696w, https://www.osradar.com/wp-content/uploads/2018/09/12-2-1068x413.png 1068w, https://www.osradar.com/wp-content/uploads/2018/09/12-2-1087x420.png 1087w" sizes="(max-width: 1131px) 100vw, 1131px" /><figcaption id="caption-attachment-5728" class="wp-caption-text">12.- Checking the virtual hosts</figcaption></figure>
<figure id="attachment_5729" aria-describedby="caption-attachment-5729" style="width: 890px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-5729" src="https://www.osradar.com/wp-content/uploads/2018/09/13.png" alt="13.- Checking virtual hosts" width="890" height="417" srcset="https://www.osradar.com/wp-content/uploads/2018/09/13.png 890w, https://www.osradar.com/wp-content/uploads/2018/09/13-300x141.png 300w, https://www.osradar.com/wp-content/uploads/2018/09/13-768x360.png 768w, https://www.osradar.com/wp-content/uploads/2018/09/13-696x326.png 696w" sizes="(max-width: 890px) 100vw, 890px" /><figcaption id="caption-attachment-5729" class="wp-caption-text">13.- Checking virtual hosts</figcaption></figure>
<p>And this is it. As you can see it&#8217;s really simple.</p>
<p>Tell us, how was your experience with Apache?</p>
<p>Please spread this article through your social networks.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-configure-an-apache-virtual-host-on-debian-9/">How to configure an Apache Virtual host on Debian 9?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-configure-an-apache-virtual-host-on-debian-9/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
