HTTP / Apache / Web Server Configuration
Apache is the most useful Web Server used today it’s based on http. Apache provide simple and secure access to all types of content using the regular http protocol.
Configuration procedure:
1. Install the package needed by provided the service. The RPM packages required by Apache are included in the web server package group
2. Configure the SE Linux to support the service.
3. Configure the service to start when system is booted.
4. Configure the service for basic operation.
5. Configure host based & user based security for the service.
Configuration Files:
1. /etc/httpd/conf/httpd.conf
Daemons:
1. httpd
Requirements:
1. YUM
2. DNS
# yum install system-config-httpd (Install all 7 required packages)
1. system-config-httpd 5. httpd
2. alchemist 6. libxslt-python
3. apr 7. postgresql-libs
4. apr-util
# vi /etc/httpd/conf/httpd.conf (open httpd configuration file)
Assign line no through :se nu and go to below line and change.
971 erases # sign and write IP of server after Name VirtualHost.
984 erases # sign and write IP of server after VirtualHost.
985 erase # sign and write http admin name after ServerAdmin and
Server FQDN name.
986 erase # sign and write /var/www/ after Domain Root
987 erase # sign and write server FQDN name after ServerName
990 erase # sign
Then :wq!
Ex:-
971 NameVirtualHost 192.168.1.3:80
984 <VirtualHost 192.168.1.3:80>
985 ServerAdmin root@server.linux.com
986 DocumentRoot /var/www/
987 ServerName server.linux.com
990 </VirtualHost>
# vi /var/www/html/site (For create a file in html dir. in this file we can write script of HTML) then save it with :wq!
HTTP/ Apache / Web Security
1st Step:
# vi /etc/httpd/conf/httpd.conf (Open httpd.conf file and add some new lines)
987
988 <Directory /var/www/html>
989 AllowOverride Authconfig
990 </Directory>
991
992
993 </VirtualHost>
2nd Step:
# vi /var/www/html/.htaccess (Make ht.access file in html & write below line)
AuthName “Restricted stuff”
AuthType Basic
AuthUserFile /etc/httpd/conf/htpasswd
Require valid-user
# adduser nilesh (Add a user for access http)
# passwd nilesh (Assign encrypted password of user)
# htpasswd –cm /etc/httpd/conf/htpasswd nilesh (For assign http password)
Here: -c = Create the passwd file
-m= For MD5 encryption of passwords
# vi /etc/httpd/conf/htpasswd (This is http users passwd file)
# chgrp apache /etc/httpd/conf/htpasswd (For change Group to apache)
# chmod g+r /etc/httpd/conf/htpasswd (For assign read permission to apache)
# ll /etc/httpd/conf/htpasswd (For checking permissions)
# service httpd restart
Client Side Configuration:-
# service network restart
# firefox
Give http://ipofserver/html/filename (who is save in /html for open the http)
No comments:
Post a Comment