Apache server and Nginx in Linux system. | cloudpradeep |
Apache server and Nginx in Linux system.
What is Apache service?
Apache service is a webserver application that helps to deliver web-services through the internet.
It is a open-source and cross platform service. It is developed and maintained by an open source community.
It is most commonly use on Unix-like system.
This software is available for Unix, Linux, Os X, free BSB , windows based operating system.
Prerequire things :-
Root user permission.
Internet connection.
Apache package.
Port 80 should be enabled.
Firewall should be configured.
How to install Apache in linux?
#yum install httpd ( for installing apache service )
# systemctl startt httpd ( For start the service )
#systemctl status httpd ( For verify the status )
#systemctl restart httpd ( For restart the serrvice )
Configure :-
The main configuratio directory is / etc/ httpd /conf.d and the main configuration file is apache2.conf d.
STEP 1 :-
Create a file at / etc/ httpd/ conf.d/domain .com.conf
For port enable :-
<virtualhost *:80="">
ServerAdmin root@sahoo.com
ServerName sahoo.com
ServerAlias www.sahoo.com
DocumentRoot /var/www/html/ sahoo.com/
ErrorLog /var/log/httpd/ sahoo.com/error.log
CustomLog /var/log/httpd/ sahoo.com/access.log combined
</virtualhost>
STEP 2 :-
Create a dir for the website and create index.html
#mkdir /var / www/ html /sahoo.com
#vi / var /www /sahoo.com/index.html
STEP 3 :-
Restart the apache server .
#systemctl restart httpd
STEP 4 :-
Open your browser and enter the website url.
How to create a simple Apache webserver in Linux?
To start a Apache web server in Linux first, we should enable httpd service In our system.
Now simply type this command :-
# Cd html/
# ls
# vim index.html
It will open your vim text editor and now we have to add our html website content like this.
{
<html>
<title> Pradeepsahoo.com </title>
<body>
<h1> Demo website for Apache server. </h1>
<p> Hello my name is Pradeep kumar sahoo and this is my demo website. </p>
</body>
</html>
}
Now our demo website is ready and we need to verify the service is working or not, to do this just type this command.
# systemctl start httpd
# systemctl enable httpd
# systemctl show httpd
Now open your browser and enter your ip address and you will show your created website on your browser.
What is Nginx service?
Nginx service is a webserver application that helps to deliver web service through internet.
It is a open source software for web serving.
It provide much more performance and stability in comparing to other web service provider.
Prerequire things for nginx?
Root user permission.
Internet connection.
Package for nginx.
Firewall should be configure.
What is EPEL ?
EPEL stands for Extra Package Enterprise Linux . It is a commnity package that helps to install extra package into the enterprise linux.
Prerequire things :-
Root user permission.
Internet connection.
How to install EPRL in linux :-
To install the epel in lInux we need to run this comand in terminal :
#yum install epel-relese
How to configure Nginx in Linux ?
For configuring nginx in a linux machine first we have to install ngnix package into the machine.
STEP 1 :-
Install Nginx using EPEL repository.
#yum install epel-release
#yum install nginx
Now type Y to continue the process and completing the installation.
STEP 2 :- ( Manage Ngnix http server )
#systemctl start nginx ( Start nginx service )
#systemctl enable ngnix (for start on boot )
#systemctl status ngnix ( checking the status )
STEP 3 :- ( Configure firewall and allowing port )
#firewall-cmd --zone=public --permanent –add-service=http
#firewall-cmd --zone=public --permanent –add-service=https
Now reload the firewall setting.
# firewall-cmd –reload
Now get the ip address and run in your browser to test .
What is Wildcard ?
Wildcard is a searching tool that helps to find files or inside a document findin some text we use wild-card.
It is used to run matching files like :-
ls host* ( ls – is the command, host – is the file name and * -- is the wild card that refer anything after the file host. )
Some regular wildcard in linux :-
(* ) = Asterisk or start symbol. It is used to list everything if we don’t know exact file name .
Example :- ls *file – It will list the files or dir whose ending name is file.
( ? ) = Question mark
It matches everyotherr possible character.
Example :- ls file? - it will list those file that starting from name file and at the ending no matter which character have.
? - Must have the character.
[] -- Square bracket
It is much similar like Questionmark but expect some special characters.
In Question mark ( ? ) used every possible characters but in [] some special characters.
Exapmle :- ls [nha]* -- it will list files that starting from n,H,a letters .
Ls [ ! abc ] -- It will list and match anyother character expect these charactor.
4. {} -- Currly brackets
It’s also called helping unit, means that by using this unit we can perform multiple expression at a time.
Example :- ls {*.c*, *.txt}
Here it will follow OR contiotion and show the two different typesof files types.
5. ( \ ) -- Escape Character
It will use when we want the next character shouldn’t be treatet as some special character like * , \ etc.
Example :- touch file\123 = it will create an file named file123.
But iwant to create a file nnemed file\123 then i will this wildcard like this .
Touch file\\123
No comments