How to install and configure Apache2 for Webhosting on Linux (Ubuntu 14.04)
Apache2 Installation and Configuration on Ubunut 14.04
and run two instant website on server.
____________________________________________
Step1 After install Ubunut 14.04
____________________________________________
Goto Terminal
$sudo apt-get update
$sudo apt-get install apache2
by default all apache2 file install in /etc/apache2/
And location of where we put our website contain /var/www/
____________________________________________
Step2
_____________________________________________
Goto /var/www/
and creat a folder name /arvweb
and creat a demo file/page under /arv/arv.html by using below command
$sudo mkdir -p /var/www/arv
$sudo nano /var/www/arv/arv.html
#(and past below text)
<html>
<head>
<title>Welcome to arv.com!</title>
</head>
<body>
<h1>Success! arvapache.blogspot.com</h1>
</body>
</html>
____________________________________________
Step3
____________________________________________
Now give permission for file and folder of /var/www/arv/
$sudo chown -R $USER:$USER /var/www/arv
$sudo chmod -R 755 /var/www
_________________________________________________
Step4
_________________________________________________
Create New Virtual Host Files
$sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/<hostname>.conf
Example
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/arv.allcad.home.conf
Goto
$cd /etc/apache2/site-availabe
$ls
arv.allcad.home.conf 000-default.conf
$sudo nano arv.allcad.home.conf
```Now edite file accroding your default.conf for your new file just change your file location and domain like we create below text
<VirtualHost arv.allcad.home:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
ServerName arv.allcad.home
DocumentRoot /var/www/arv
<Directory /var/www/arv/>
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted
DirectoryIndex arv.html
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
____________________________________________________
Step5
____________________________________________________
Add some changes in your hostfile
$sudo nano /etc/hosts
127.0.0.1 localhost
127.0.1.1 pc073
192.168.5.123 arv.allcad.home
___________________________________________________
Step6
___________________________________________________
Now enable your creat .conf file for run over browser
$sudo a2ensite arv.allcad.home.conf
Now goto browser and type
http://arv.allcad.home
#Arvind
and run two instant website on server.
____________________________________________
Step1 After install Ubunut 14.04
____________________________________________
Goto Terminal
$sudo apt-get update
$sudo apt-get install apache2
by default all apache2 file install in /etc/apache2/
And location of where we put our website contain /var/www/
____________________________________________
Step2
_____________________________________________
Goto /var/www/
and creat a folder name /arvweb
and creat a demo file/page under /arv/arv.html by using below command
$sudo mkdir -p /var/www/arv
$sudo nano /var/www/arv/arv.html
#(and past below text)
<html>
<head>
<title>Welcome to arv.com!</title>
</head>
<body>
<h1>Success! arvapache.blogspot.com</h1>
</body>
</html>
____________________________________________
Step3
____________________________________________
Now give permission for file and folder of /var/www/arv/
$sudo chown -R $USER:$USER /var/www/arv
$sudo chmod -R 755 /var/www
_________________________________________________
Step4
_________________________________________________
Create New Virtual Host Files
$sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/<hostname>.conf
Example
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/arv.allcad.home.conf
Goto
$cd /etc/apache2/site-availabe
$ls
arv.allcad.home.conf 000-default.conf
$sudo nano arv.allcad.home.conf
```Now edite file accroding your default.conf for your new file just change your file location and domain like we create below text
<VirtualHost arv.allcad.home:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
ServerName arv.allcad.home
DocumentRoot /var/www/arv
<Directory /var/www/arv/>
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted
DirectoryIndex arv.html
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
____________________________________________________
Step5
____________________________________________________
Add some changes in your hostfile
$sudo nano /etc/hosts
127.0.0.1 localhost
127.0.1.1 pc073
192.168.5.123 arv.allcad.home
___________________________________________________
Step6
___________________________________________________
Now enable your creat .conf file for run over browser
$sudo a2ensite arv.allcad.home.conf
Now goto browser and type
http://arv.allcad.home
#Arvind