Tuesday, November 22, 2011

APACHE WEB SERVER and Open SSH Server


 APACHE WEB SERVER

Apache Web Server is used for Web Hosting. With the help of Apache we can host multiple Website.

Service Profile

Type                               :        System V Manage
Daemon                         :        httpd
Script                              :        httpd
Port                                 :        80
Package                          :        httpd, portmap

Configuration File        :        /etc/httpd/conf/httpd.conf

Steps:

  1. Check the rpm
#rpm –q httpd

  1. For multiple Hosting we need to uncomment line number 1003
NameVirtualHost  172.24.254.254:80
Now copy line No 1016 to No. 1022 and paste at last

<VirtualHost 172.24.254.254:80>
DocumentRoot /www
ServerName  server1.example.com
</VirtualHost>

Save and exit

Now create a directory
#mkdir /www
#cd /www
#vi index.html

Now start the service
#service httpd restart
#service portmap restart
#chkconfig httpd on
#chkconfig portmap on

Now dig the site
#dig server1.example.com
Restriction For User to Access Web site

#vi /etc/httpd/conf/httpd.conf
<VirtualHost 172.24.254.254:80>
            ServerAdmin   root@server1.example.com
            DocumentRoot  /www
            ServerName Server1.example.com
            <Directory /www>
                        Option Indexes Includes
                        AllowOverride Authconfig
            </Directory>
</VirtualHost>

Now create one file .htaccess in /www
#vi /www/.htaccess
AuthName  “allow users”
AuthType  Basic
AuthUserFile  /etc/httpd/ht.access
Require valid-user

Save and Exit

Now create one user
#adduser jeet
#htpasswd –c /etc/httpd/ht.access jeet
#chgrp apache /etc/httpd/ht.access


Start the Service
#service httpd restart
#chkconfig httpd on


Open SSH Server

SSH or Secure Shell is used for the purpose of remote login between linux to linux and linux to Unix. The mail difference between SSH and telnet is that SSH can be used for file transfer.

Service Profile

Type                           :        System V manage
Package                     :        open ssh, open ssh-server, openssh-client
Daemon                     :        sshd
Port                             :        22
Script                          :        sshd
Configuration File    :        /etc/ssh/sshd-config


If you want root should not login then

#vi /etc/ssh/sshd-config
Line
PermitRootLogin        No
Uncomment line number 13 and 14
Port  22
Protocol 2,1
Save and exit

Start the service
#service sshd restart
#chkconfig sshd on

#ssh jeet@172.24.254.254    ( by User)
#ssh 172.24.254.254   (By root)
If you want to display any welcome Note at the time of connecting
#Banner
Banner /etc/banner

If you want to copy file from ssh server to client
#scp 172.24.254.254:/root/install.log  /mnt

If you want to directory
#scp –r 172.24.254.254:/root/jeet   /mnt

If you want to copy file from client machine to ssh server
#scp /root/anaconda-ks.cfg  172.24.254.254:/root
Remote shut down
#ssh 172.24.0.6 init 6
Or
Slogin command can also be used

 

No comments:

Post a Comment