Wednesday, 25 September 2013

Apache HTTP Server Version 2.4 installation & SSL Configuration

2.  Extract: gzip -d httpd-NN.tar.gz | cd httpd-NN
3.  Configure:
./configure –prefix=PREFIX  (PREFIX must be replaced with the filesystem path under which the server should be installed. If PREFIX is not specified, it defaults to /usr/local/apache2.)
Eg: #./configure --prefix=/usr/local/apache2 --with-included-apr --enable-ssl --enable-so
Or
#./configure --with-included-apr --enable-ssl --enable-so

With pcre:
./configure --with-included-apr --with-pcre=/opt/apache/httpd-2.4.6/srclib/pcre/pcre-config --enable-ssl --enable-so

4.  Compile: #make
5.  Install: #make install
6.  Test: PREFIX/bin/apachectl –k start

Requirements
1.  APR and APR-Util: download the latest versions of both APR and APR-Util from http://apr.apache.org/ un-tar them into ./srclib/apr and ./srclib/apr-util (be sure the domain names do not have version numbers;and keep this two files APR and APR-Util in httpd-2.4.6/srclib.Remove the version number. for example, the APR distribution must be under ./srclib/apr/) and use ./configure's --with-included-apr  option.
2.  Perl-Compatible Regular Expressions Library (PCRE: This library is required but no longer bundled with httpd. Download the source code from http://www.pcre.org, or install a Port or Package.1.  keep this pcre files in httpd-2.4.6/srclib.Remove the version number.
Enable SSL in httpd.conf
Apache configuration file httpd.conf is located under PREFIX/apache2/conf       (eg: /usr/local/apache2/conf).
Uncomment the httpd-ssl.conf Include line and the LoadModule ssl_module line in the /usr/local/apache2/conf/httpd.conf file.
# vi /usr/local/apache2/conf/httpd.conf
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf


View the httpd-ssl.conf to review all the default SSL configurations. For most cases, you don’t need to modify anything in this file.
# vi /usr/local/apache2/conf/extra/httpd-ssl.conf
The SSL certificate and key are required before we start the Apache. The server.crt and server.key file mentioned in the httpd-ssl.conf needs to be created before we move forward.
# cd /usr/local/apache2/conf/extra
# egrep 'server.crt|server.key' httpd-ssl.conf
SSLCertificateFile "/usr/local/apache2/conf/server.crt"
SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"

Create server.crt and server.key file

First, Generate the server.key using openssl.
# cd /usr/src
# openssl genrsa -des3 -out server.key 1024
The above command will ask for the password. Make sure to remember this password. You need this while starting your Apache later.
Next, generate a certificate request file (server.csr) using the above server.key file.
# openssl req -new -key server.key -out server.csr
Finally, generate a self signed ssl certificate (server.crt) using the above server.key and server.csr file.
# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
After you’ve done with the above steps, you’ll see the following three files under /usr/src
# ls server*
server.crt  server.csr  server.key
Copy the server.key and server.crt file to appropriate Apache configuration directory location.
cp server.key /usr/local/apache2/conf/
cp server.crt /usr/local/apache2/conf/

Start the Apache

If you are getting the below error message, make sure to uncomment the line shown below in httpd.conf
# /usr/local/apache2/bin/apachectl start
AH00526: Syntax error on line 51 of /usr/local/apache2/conf/extra/httpd-ssl.conf:
Invalid command 'SSLCipherSuite', perhaps misspelled or defined by a module not included in the server configuration
 
# vi /usr/local/apache2/conf/httpd.conf
LoadModule ssl_module modules/mod_ssl.so
If you are getting the below error message, make sure to uncomment the line shown below in httpd.conf
# /usr/local/apache2/bin/apachectl start
AH00526: Syntax error on line 76 of /usr/local/apache2/conf/extra/httpd-ssl.conf:
SSLSessionCache: 'shmcb' session cache not supported (known names: ). Maybe you need to load the appropriate socache module (mod_socache_shmcb?).
 
# vi /usr/local/apache2/conf/httpd.conf
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
Finally, this will prompt you to enter the password for your private key before starting up the apache.
# /usr/local/apache2/bin/apachectl start
Apache/2.4.2 mod_ssl (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide the pass phrases.
Server www.example.com:443 (RSA)
Enter pass phrase:
OK: Pass Phrase Dialog successful.
Verify that the Apache httpd process is running in the background
# ps -ef | grep http
root   29529     1  0 13:08 ?     00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 29530 29529  0 13:08 ?     00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 29531 29529  0 13:08 ?     00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 29532 29529  0 13:08 ?     00:00:00 /usr/local/apache2/bin/httpd -k start
root   29616 18260  0 13:09 pts/0 00:00:00 grep http
To stop the apache use apachectl stop.
# /usr/local/apache2/bin/apachectl stop
Use httpd -l to view all the modules that are compiled inside the Apache httpd daemon.
# /usr/local/apache2/bin/httpd -l
Compiled in modules:
  core.c
  mod_so.c
  http_core.c
  event.c
By default Apache SSL runs on 443 port. Open a web browser and verify that you can access your Apache using https://{your-ip-address}.




13 comments:

  1. I have seen a lot of blogs and Info. on other Blogs and Web sites But in this Hadoop Blog Information is useful very thanks for sharing it........

    ReplyDelete
  2. Very Much Helpful for Me. Thanks a lot

    ReplyDelete
  3. Thanks For Your valuable posting Start your path in Hadoop training in Hyderabad

    ReplyDelete
  4. Online Assignment Help Tasmania - Australia Best Tutor is responsible for providing an excellent range of Online Assignment help Tasmania to the students pursuing different subjects as part of their studies.

    Read More : http://prsync.com/australia-best-tutor/get-good-grades-by-using-the-online-assignment-help-tasmania-2589126

    ReplyDelete
  5. Best article, very useful and explanation. Your post is extremely incredible. Thank you very much for the new information.
    Node Js course with placement in Hyderabad
    Node Js course in Hyderabad with placement
    Node Js Training Center in Hyderabad

    ReplyDelete
  6. This is really an important blog with many helpful information. I have been searching for a long time for this types of content. Keep up posting more and thanks for your great staff.
    Home Maintenance Company in Islamabad,

    ReplyDelete
  7. reat Article. Thank you for sharing! Really an awesome post for every one.

    IEEE Final Year projects Project Centers in India are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Projects for CSE It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

    JavaScript Online Training in India

    JavaScript Training in India

    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

    ReplyDelete
  8. I really enjoyed reading this article. Great work. The topic you have mentioned are very useful. Thanks for sharing this post.
    Accountants in walthamstow

    ReplyDelete
  9. This has to be one of the most intelligent web contents I've come across in recent times. The style and delivery is similar to how we have the NCLEX CERTIFICATE FOR SALE​ ​ that is changing the lives of State Registered Nurses right now.

    Whenever there is a better way to BUY NCLEX CERTIFICATE ONLINE​ ​ I'll make sure to keep you and your audience informed. You can join our group of Database certificates experts @ TELEGRAM GROUP​ ​
    I'll definitely bookmark this link so I can always come back for more informative content. Cheers y'all and happy new year.

    ReplyDelete