Apache-2.4+tomcat-7+ssl +virtualhost+ Self-signed certificate installation Test _php tutorial

Source: Internet
Author: User

Apache-2.4+tomcat-7+ssl +virtualhost+ Self-signed certificate installation test



First, install the lazy package

1. Install Apr Package
# wget-c HTTP://FTP.CUHK.EDU.HK/PUB/PACKAGES/APACHE.ORG//APR/APR-1.5.2.TAR.BZ2
#tar-JXVF apr-1.5.2.tar.bz2
#cd apr-1.5.2
#./configure--prefix=/usr/
#make
# make Install

2. Install the Apr-util package
# wget HTTP://FTP.CUHK.EDU.HK/PUB/PACKAGES/APACHE.ORG//APR/APR-UTIL-1.5.4.TAR.BZ2
#tar-JXVF apr-util-1.5.4.tar.bz2
#cd apr-util-1.5.4
#cd/usr/local/src/apr-util-1.5.4
#./configure--prefix=/usr/--with-apr=/usr/
#make
#make Install

3. Install the PCRE package
#wget-C Http://sourceforge.net/projects/pcre/files/pcre/8.37/pcre-8.37.tar.bz2/download
# TAR-JXVF PCRE-8.37.TAR.BZ2
#cd pcre-8.37
#./configure--prefix=/usr/local/
#make
#make Install

Second, install Apache software package

#wget-C http://apache.fayea.com//httpd/httpd-2.4.16.tar.bz2
#cd httpd-2.4.16
#./configure--prefix=/usr/local/apache-2.4--enable-modules=all--enable-mods-shared=all--enable-ssl
#make
#make Install

Third, turn on SSL support
1, modify VI httpd.conf Open
LoadModule Ssl_module modules/mod_ssl.so
LoadModule Socache_shmcb_module modules/mod_socache_shmcb.so
Include conf/extra/httpd-ssl.conf


Iv. generate self-issued certificates:
# cd/usr/local/apache-2.4/conf/
#openssl req-x509-nodes-days 3650-newkey rsa:2048-keyout server.key-out server.crt
#根据实际情况填写国家, organization, region, company name generate self-signed certificate

V. Start Aapche software testing.
#/usr/local/apache-2.4/bin/apachectl start
https://Access, note Firewall on port 443


Six, apache+tomcat-7 United


1. Install JDK slightly
# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.64/bin/apache-tomcat-7.0.64.tar.gz
# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.41-src.tar.gz
2. Install Tomcat
# TAR-ZXVF Apache-tomcat-7.0.64.tar.gz
# ln-s Tomcat apache-tomcat-7.0.64

3. Installing the Tomcat-connectors module
# TAR-ZXVF Tomcat-connectors-1.2.41-src.tar.gz
# CD TOMCAT-CONNECTORS-1.2.41-SRC
#./buildconf.sh
#./configure--with-apxs=/usr/local/apache-2.4/bin/apxs--with-tomcat=/usr/local/tomcat--with-java-home=/usr/ LOCAL/JDK--with-jni
#make
#make Install

Seven, open the MOD_JK module

Modify VI httpd.conf finally add the following to enable MOD_JK module support

# Load MOD_JK Module
LoadModule Jk_module modules/mod_jk.so
# Where to find Workers.properties
Jkworkersfile/usr/local/apache/conf/workers.proferties
# Where to put JK logs
Jklogfile/usr/local/apache/logs/mod_jk.log

# Set the JK log level [Debug/error/info]
Jkloglevel Info

# Select the timestamp log format
Jklogstampformat "[%a%b%d%h:%m:%s%Y]"

# Jkrequestlogformat Set the request format
Jkrequestlogformat "%w%V%T"

# jkoptions indicate to send SSL KEY SIZE,
Jkoptions +forwardkeysize +forwarduricompat-forwarddirectories

# Send servlet for context/examples to worker named Worker1
#JkMount/examples/*.jsp Worker1
jkmount/servlet/* Worker1

# Send JSPs for context/examples to worker named Worker1
Jkmount/*.jsp Worker1

Viii. New Workers.proferties file

[Root@localhost conf]# more Workers.proferties
Workers.tomcat_home=/usr/local/tomcat
Workers.java_home=/usr/local/jdk
ps=/
Worker.list=worker1
worker.worker1.port=8009
Worker.worker1.host=localhost
Worker.worker1.type=ajp13
worker.worker1.connection_pool_timeout=600
Worker.worker1.socket_keepalive=1
Worker.worker1.lbfactor=1
worker.inprocess.stdout=$ (workers.tomcat_home) $ (PS) logs$ (PS) inprocess.stdout
worker.inprocess.stderr=$ (workers.tomcat_home) $ (PS) logs$ (PS) inprocess.stderr
[Root@localhost conf]#

Nine, apache+tomcat+ssl+ virtual host:

1, modify: httpd-ssl.conf Add the following virtual host




# General setup for the virtual host
DocumentRoot "/www/clients/aaa.com/htdocs"
ServerName www.aaa.com:443
ServerAdmin you@example.com
Errorlog "/www/clients/aaa.com/logs/error_log"
Transferlog "/www/clients/aaa.com/logs/access_log"



Options-indexes +followsymlinks
AllowOverride All
Require all granted
DirectoryIndex login.jsp index.jsp



#JkMount/examples/*.jsp Worker1
jkmount/servlet/* Worker1


# Send JSPs for context/examples to worker named Worker1
Jkmount/*.jsp Worker1




# SSL Engine Switch:
# enable/disable SSL for this virtual host.


Sslengine on


Sslcertificatefile "/USR/LOCAL/APACHE-2.4/CONF/SERVER.CRT"
Sslcertificatekeyfile "/usr/local/apache-2.4/conf/server.key"



Ssloptions +stdenvvars


Ssloptions +stdenvvars



Browsermatch "MSIE [2-5]" \
Nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0


Customlog "/usr/local/apache-2.4/logs/ssl_request_log" \
"%t%h%{ssl_protocol}x%{ssl_cipher}x \"%r\ "%b"










# General setup for the virtual host
DocumentRoot "/www/clients/bbb.com/htdocs"
ServerName www.bbb.com:443
ServerAdmin you@example.com
Errorlog "/www/clients/bbb.com/logs/error_log"
Transferlog "/www/clients/bbb.com/logs/access_log"



Options-indexes +followsymlinks
AllowOverride All
Require all granted
DirectoryIndex login.jsp index.jsp



#JkMount/examples/*.jsp Worker1
jkmount/servlet/* Worker1


# Send JSPs for context/examples to worker named Worker1
Jkmount/*.jsp Worker1




# SSL Engine Switch:
# enable/disable SSL for this virtual host.


Sslengine on


Sslcertificatefile "/USR/LOCAL/APACHE-2.4/CONF/SERVER.CRT"
Sslcertificatekeyfile "/usr/local/apache-2.4/conf/server.key"



Ssloptions +stdenvvars


Ssloptions +stdenvvars



Browsermatch "MSIE [2-5]" \
Nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0


Customlog "/usr/local/apache-2.4/logs/ssl_requbbest_log" \
"%t%h%{ssl_protocol}x%{ssl_cipher}x \"%r\ "%b"





X. Add a TOMCAT virtual host:


1, modify: Tomcat configuration file Server.xml Add the following:





Www.aaa.com




prefix= "Aaa.com_access_log" suffix= ". txt"
pattern= "%h%l%u%t"%r "%s%b"/>


debug= "0" reloadable= "true"/>








Www.bbb.com




prefix= "Bbb.com_access_log" suffix= ". txt"
pattern= "%h%l%u%t"%r "%s%b"/>



debug= "0" reloadable= "true"/>





Xi. Writing test pages:

[Root@localhost htdocs]# pwd
/www/clients/aaa.com/htdocs
[Root@localhost htdocs]# more index.jsp


<title>JSP test Page</title>


<%out.println ("

Hello wwww.aaa.com world!

");%>


[Root@localhost htdocs]#


[Root@localhost htdocs]# pwd
/www/clients/bbb.com/htdocs
[Root@localhost htdocs]# more index.jsp


<title>JSP test Page</title>


<%out.println ("

Hello wwww.bbb.com world!

");%>


[Root@localhost htdocs]#


12. Start: Apache, Tomcat to test
#/usr/local/apache/bin/apachectl Start
#/usr/local/tomcat/bin/startup.sh

2. Modify native host hosts Test
Https://www.aaa.com
Https://www.bbb.com

Attached: Optimize TOMCAT parameters: Modify: catalina.sh file Add the following red Word
# Set Juli Logmanager config file if it is present and an override have not been issued
If [-Z "$LOGGING _config"]; Then
If [-R ' $CATALINA _base "/conf/logging.properties]; Then
logging_config= "-djava.util.logging.config.file= $CATALINA _base/conf/logging.properties"
Else
# Bugzilla 45585
Logging_config= "-dnop"
Fi
Fi
Java_opts= "-server-xms256m-xmx2048m-xx:permsize=64m-xx:maxnewsize=256m-xx:maxpermsize=512m"

http://www.bkjia.com/PHPjc/1067486.html www.bkjia.com true http://www.bkjia.com/PHPjc/1067486.html techarticle Apache-2.4+tomcat-7+ssl +virtualhost+ Self-issued certificate installation test one, install the lazy Package 1, install the APR package # wget-c Http://ftp.cuhk.edu.hk/pub/packages /apache.org//apr/ap ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.