Ticker

6/recent/ticker-posts

Installing Apache In Linux

Apache is an open source and free web server that’s available for All Linux System.


Apache server in setting some steps :-

How to set up Apache Server

Basic configuration Apache 

What will need :-

Ubuntu Server Any Version

Secure Shell (SSH) access to your server

Basic knowledge Linux cmd and web server

Installation Steps :-

First one open the cmd line after install the latest meta-package apache2 :

sudo apt update
sudo apt install apache2


After command run all Packages are installed and we can test it out by typing in our Localhost or IP address for the browser or web server.


Apache page




If see this page above it means Apache has been successfully installed on your server.


How to create own website :-


Apache in by default site is enabled. We can modify and chnages in cd /var/www/html and configuration file editingn in cd /etc/apache2/sites-enabled/000-default.conf.

So let’s start by creating www.example.com and set up our own xyz.example.com.

first one create new folder in /var/www/ 

sudo mkdir /var/www/xyz/


Now we have create directory in our site.


cd /var/www/xyz/
nano index.html

Paste the following code in the index.html file:

<html>
<head>
  <title> Hello Sohan Patel </title>
</head>
<body>
  <p> I'm Blogger of Window and Linux System </p>
</body>
</html>


VirtualHost Configuration File in settings :-


Configuration file Directory in 

cd /etc/apache2/sites-available/

Apache in default VirtualHost file, let’s use that as a base. (xyz.conf is our subdomain name in chnages):

sudo cp 000-default.conf xyz.conf


Now editing in configuration file:


sudo nano xyz.conf

we have add in email ServerAdmin so users can reach you in case Apache experiences any error:

ServerAdmin yourname@example.com

We have also add DocumentRoot directory our site files are hosted on:

DocumentRoot /var/www/xyz/

We have add ServerName and define it by adding this line below :

ServerName xyz.example.com

The ensures people reach the right site instead of the default one when they type in xyz.example.com.


VirtualHost file Activating : -


After set our website, we have activate the virtual hosts configuration file to enable it. We do that by running the following command :

sudo a2ensite xyz.conf


Output following :-


Enabling site xyz.

To activate the new sie and configuration file in reload apache2

  service apache2 reload


website

Browser in activate your site enjoy it..............


Different Between Windows VS Linux :-



Reactions

Post a Comment

0 Comments