Packages required
|
httpd, httpd-devel, httpd-manual
|
Daemon
|
/usr/sbin/httpd
|
Script
|
/etc/init.d/httpd
|
Ports
|
80/tcp (http) , 443/tcp (https)
|
Configuration
|
/etc/httpd/*
/var/www/* |
Step
1: Install the web server packages using yum
# yum install httpd*
Step 2: Edit the configuration file which is
“/etc/httpd/conf/httpd.conf”
# vim /etc/httpd/conf/httpd.conf
Ø
Find
the line containing this one (around line nu 270)
#ServerName www.example.com:80
And make it as
ServerName server.example.com:80
Here server.example.com is the hostname of my
server
Ø
Next,
find the line containing (around line nu 990)
#NameVirtualHost *:80
And make it as below
NameVirtualHost 192.168.10.100:80
Here 192.168.10.100 is the ip of my server.
Ø
Now
edit the last 7 lines
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
As
<VirtualHost 192.168.10.100:80>
ServerAdmin root@server.example.com
DocumentRoot /var/www/html
ServerName server.example.com
ErrorLog logs/server.example.com-error_log
CustomLog logs/server.example.com-access_log common
</VirtualHost>
Ø Of the above mentioned configuration
“DocumentRoot
/var/www/html” is the location of our index.html page.
“ServerName server.example.com”
is the name which is used to browse/access the content in the “/var/www/html”
directory.
That’s all about editing the configuration
file. Now save and quit the editor.
Step 3: Now create the contents in the default
web server’s home directory (index.html)
# vim /var/www/html/index.html
<marquee>
Welcome to server.redhat.com
</marquee>
Now exit the editor.
Step 4: Now check the Selinux context of
index.html
The newly created index.html file will not
have the selinux context required for web server. So add the policy
# chcon -R --reference=/var/www/html/ /var/www/html/index.html
Check whether it has the right context
# ls -lZ /var/www/html/index.html
-rw-r--r--. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html/index.html
Now its ok.
Step 5: Start the daemon
# service httpd start
# chkconfig httpd on
Step 6: Browse the contents
links <URL> Ex: links http://server.redhat.com
1 comments:
it's working properly.
very nice
Post a Comment