2 June 2017

How to Configure the HTTPS in Linux

#### HOW TO CONFIGURE HTTPS IN LINUX###########
first configure the http
step-1: To assign the Hostname
login the linux CentoOS with root user
#hostname (to Check the hostname)
#ifconfig (to Check the IP Address)
#vi /etc/hosts (to provide the ip & hostname)
like 172.35.32.230    www.myblog.com   www
:wq (save & quit)

#vi /etc/hostname   (to make permanent) 
www.myblog.com
:wq   (save & quit)

##### INSTALL THE PACKAGE#####

#yum install http*    mod_ssl*   -y



#rpm -qa http*    mod_ssl*   (to query )

##### CONFIGURE THE HTTP#####

#vim /etc/httpd/conf/httpd.conf

come to end of file and write below text

<VitrualHots *:80>
ServerAdmin    root@myblog.com
DocumentRoot    //var/www/html
DirectoryIndex    myblog.html
ServerName    www.myblog.com
</VirtualHost>

:wq  (save & quit)


#cd /var/www/html    (To enter the directory )
#vi  myblog.html    (to Create the html home page )

##### START THE HTTP SERVICE #####

#service httpd restart

#### OPEN THE BROWSER THROUGH THE TEMINAL######
#firefox http://www.myblog.com

########### TO CREATE THE CERTIFICATES & KEY ######
#cd /etc/pki/tls/certs   (to enter the dir)
#make myblog.crt    (to create the certificates )
#ls    (to check )

#mv myblog.key   /etc/pki/tls/private    (To move the key)

### TO CONFIGURE THE HTTPS#######

#vim /etc/httpd/conf.d/ssl.conf

go to line no. 100 replace localhost.crt myblog.crt
go to line no. 107 replace localhost.key myblog.key

come end of the file and add this parameter

ServerAdmin root@myblog.com
DocumentRoot    /var/www/html
DirectoryIndex   myblog.html
ServerName    www.myblog.com

:wq    (save & exti)

####### TO START THE SERVICE #########
#service httpd restart

##### TO OPEN THE BROWSER########

# firefox https:/www.myblog.com

######### TO REDIRECT HTTP TO HTTPS###########
#vim /etc/httpd/conf/httpd.conf

come end of file

above this </VirtualHost>
write this line
Redirect / https://www.myblog.com:443

:wq

#service httpd restart
##### OPEN THE BROWSER########
#firefox http://www.myblog.com
######## TO CHECK THE LOGFILE OF HTTP######
# tail /var/log/httpd/access_log

No comments: