Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Sunday, 26 March 2017

Install & Configure Lighttpd with SSL on CentOS/RHEL 6x

Install & Configure Lighttpd with SSL on CentOS/RHEL 6x


Q. What is Lighttpd ?

-- Lighttpd is a Web Server for UNIX/Linux and Windows operating systems. It is an alternative to Apache Web Server. It is also called Lighty. It is designed to be Secure, fast, standards-compliant, and flexible while being optimized for speed-critical environments.

Step: 1. Bind Host File :

# vi /etc/hosts

10.100.97.40    ser4.domain.com     ser4

-- Save & Quit (:wq)

Step: 2. Disable Selinux & Stop Iptables :

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Step: 3. Rebbot the System :

# init 6

Step: 4. Install Lighttpd Server :

# yum -y install epel-release
# yum -y install lighttpd openssl

Step: 5. Disable IPv6 Support :

# vi /etc/lighttpd/lighttpd.conf

server.use-ipv6 = "disable"
server.max-fds = 2048

-- Save & Quit (:wq)

Step: 6. Start Lighttpd Server :

# service lighttpd restart
# chkconfig lighttpd on

Step: 7. Create Certificate Signing Request (CSR) :

# mkdir /etc/lighttpd/ssl/
# cd /etc/lighttpd/ssl/

# openssl req -new -newkey rsa:2048 -nodes -keyout ser4.domain.com.key -out ser4.domain.com.csr

Country Name (2 letter code) [XX]: IN
State or Province Name (full name) []: WB
Locality Name (eg, city) [Default City]: Kolkata
Organization Name (eg, company) [Default Company Ltd]: Organization_Name
Organizational Unit Name (eg, section) []: IT
Common Name (eg, your name or your server's hostname) []: ser4.domain.com
Email Address []: admin@domain.com

A challenge password []: Just Press Enter.
An optional company name []: Just Press Enter.

Step: 8. Request Certificate from CA :

# openssl x509 -req -days 365 -in ser4.domain.com.csr -signkey ser4.domain.com.key -out ser4.domain.com.crt
# cat ser4.domain.com.key ser4.domain.com.crt > ser4.domain.com.pem

Step: 9. Lighttpd Virtual Hosting :

# mkdir -p /var/www/domain.com/http
# mkdir /var/log/lighttpd/domain.com
# chown lighttpd:lighttpd /var/www/domain.com/http
# chown lighttpd:lighttpd /var/log/lighttpd/domain.com

# vi /etc/lighttpd/lighttpd.conf

$SERVER["socket"] == ":443" {
        ssl.engine = "enable"
        ssl.pemfile = "/etc/lighttpd/ssl/ser4.domain.com.pem" 
}

$HTTP["host"] =~ "(^|\.)domain\.com$" {
server.name = "ser4.domain.com"
server.document-root = "/var/www/domain.com/http"
accesslog.filename = "/var/log/lighttpd/domain.com/access.log"
server.error-handler-404 = "/e404.php"
}

-- Save & Quit (:wq)

Step: 10. Verify Configuration & Restart Lighttpd :

# lighttpd -t -f /etc/lighttpd/lighttpd.conf
Syntax OK

# service lighttpd restart

# netstat -tulpn | grep lighttpd
tcp        0      0 0.0.0.0:80                    0.0.0.0:*                   LISTEN      3426/lighttpd      
tcp        0      0 0.0.0.0:443                 0.0.0.0:*                   LISTEN      3426/lighttpd



Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

 

0 comments:

Post a Comment

Copyright © 2016 Kousik Chatterjee's Blog