How to configure
linux web server
Necessary rpm for web server is httpd, httpd-devel and apr
check them for install
Rpm –ivh http*
Rpm –ivh apr*
#ifconfig – check the ip address of the system
#chkconfig httpd on – this for automatic service start when
reboot the pc
#service httpd start
#service httpd status
Ver: 2.2.15
Port: 80
Conf: /etc/httpd/conf/httpd.conf
Log file:
/var/log/httpd/access_log & error_log
1.1.1
configure
virtual hosting
In
this example we will host a website www.vinita.com to apache web server. create
a documents root directory for this website and a index page
#mkdir –p /var/www/virtual/www.vinita.com/html
#nano
/var/www/virtual/www.vinita.com/html/index.html
#nano /etc/hosts
192.168.122.217 www.vinita.com
#nano /etc/httpd/conf/httpd.conf
locate virtual host tag
add the
below line
---------------------------------------------------------------------------------------------------------------------------
NameVirtualHost 192.168.122.217
---------------------------------------------------------------------------------------------------------------------------
copy
the last seven lines and paste end of the line do the changes in that as per below
---------------------------------------------------------------------------------------------------------------------------
<VirtualHost 192.168.122.217>
ServerAdmin
root@www.vinita.com
DocumentRoot
/var/www/virtual/www.vinita.com/html
ServerName
www.vinita.com
ErrorLog
logs/dummy-www.vinita.com-error_log
CustomLog
logs/dummy-www.vinita.com-access_log common
</VirtualHost>
---------------------------------------------------------------------------------------------------------------------------
Save and close
httpd.conf
#service httpd
restart
#links 192.168.122.217
or links www.vinita.com
Configure multiple
site with same ip address
/etc/hosts
192.168.122.217 www.nikita.com
#vim /etc/httpd/conf/httpd.conf
copy the last seven lines and paste end of the line do
the changes in that as per below
---------------------------------------------------------------------------------------------------------------------------
<VirtualHost 192.168.122.217>
ServerAdmin
root@www.nikita.com
DocumentRoot
/var/www/virtual/www. nikita.com/html
ServerName www.
nikita.com
ErrorLog
logs/dummy-www. nikita.com-error_log
CustomLog
logs/dummy-www. nikita com-access_log common
</VirtualHost>
---------------------------------------------------------------------------------------------------------------------------
configure multiple site with multiple ip address
Create a virtual lan card on server
and assign its an ip address of 192.168.0.253. we
will create a testing site www.nidhi.com
and will bind it with ip address of 192.168.0.253.
#vim
/etc/hosts
192.168.0.253
www.nidhi.com
#vim /etc/httpd/conf/httpd.conf
Example
: Same as above virt
How to create site alias
#vim /etc/hosts
#vim /etc/httpd/conf/httpd.conf
Add the below line in vinita’s
configuration lines( that 7 lines)
ServerAlias www.mansoor.com
No comments:
Post a Comment