Linux build HTTPS protocol for Tomcat and Apache servers

Source: Internet
Author: User

Apache HTTP Server (Apache) is an open source Web server of the Apache Software Foundation, which can run in most computer operating systems, and is one of the most popular Web server-side software due to its extensive use of multiple platforms and security. The Apache Software Foundation also has a well-known server software called Tomcat. The differences and connections between Apache HTTP Server and Tomcat are:

    • Apache only supports HTML static Web pages, you can support PHP via plugins, and Tomcat supports ASP, JSP, PHP, CGI and other dynamic Web pages.
    • Apache is implemented in C, and Tomcat uses Java to better support Servlets and JSPs.
    • Apache can run for a year without restarting, the stability is very good, Tomcat is not necessarily.
    • Apache parses static pages faster than Tomcat.
    • The server prefers Apache to use Tomcat with a JSP or Servlet.
    • Apache is earlier than Tomcat and is the predecessor of Tomcat. In essence, Tomcat can replace Apache with functionality.

First, build Tomcat

1. Get the Basic installation package

Tomcat official website: http://tomcat.apache.org/I use: apache-tomcat-7.0.68.tar.gz, tar.gz is the Linux version, the7.0 version needs the lowest 1.7JDK

JDK official website: http://www.oracle.com/technetwork/java/javase/archive-139210.html, each historical version has, I use is jdk-7u80-linux-x64.tar.gz That is 1.7.0_80 version, 64-bit operating system, if 32-bit select i586 on the line.

2. Installing the JDK

A, create a Java installation directory under Linux (own plan):mkdir-p/usr/java

B. Upload the JDK package to this directory

C, unzip the JDK package,TAR-ZXVF jdk-7u80-linux-x64.tar.gz

D, add environment variables, open the/etc/profile file,vi/etc/profile The bottom add the following, red labeled according to the actual situation of their own modification, here to write to/etc/profile file, You do not need to re-login or re-configure environment variables after rebooting.

Java_home=/usr/java/jdk1.7.0_80
Jre_home=/usr/java/jdk1.7.0_80/jre
Path= $PATH: $JAVA _home/bin: $JRE _home/bin
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib
Export Java_home jre_home PATH CLASSPATH

E, the environment variable is in effect and tested.

Source/etc/profile

Java-version

4. Install Tomcat

A. Create a Tomcat installation path under Linux (Plan yourself) mkdir-p/usr/tomcat

B, speak the Tomcat package upload to this directory

C, decompression package TAR-ZXVF apache-tomcat-7.0.68.tar.gz

E, configure start Tomcat, go to the extracted cd/usr/tomcat/apache-tomcat-7.0.68/conf/path, edit the Server.xml file

Modify the IP name of the server (localhost in the original file)

Modify the service port, theoretically 0-65555 can be, but the proposal is greater than 1000 less than 10000, not occupied on the line (netstat-an |grep xxx)

F. Start Tomcat and execute in the Cd/usr/tomcat/apache-tomcat-7.0.68/bin directory

./startup.sh #启动

./shutdown.sh #停止

G, check the Tomcat service, enter http://$IP in the browser $port return to Tom Cat's web Interface ($IP and $port represent the IP and port modified in step e, and if not, view cd/usr/tomcat/ Apache-tomcat-7.0.68/logs/catalina.out positioning, generally will not have the problem

Second, build Appache

1. Get Apache (httpd) installation package

HTTPD official website: http://www.apache.org/dist/httpd/, I use: httpd-2.2.31.tar.gz

2, installation httpd

A, create a Appache installation path under Linux (own plan) Mkdir-p/usr/appache

B, say Appache package upload to this directory

C, decompression package TAR-ZXVF httpd-2.2.31.tar.gz

D. Enter the directory you just unzipped/usr/apache/httpd-2.2.31 execute the command

./configure--prefix=/usr/apache/apache--enable-module=so
Make
Make install
Install Apache under the/usr/apache/apache directory

E. Start the HTTP server and test

Service httpd Start #启动

Sevice httpd Stop #停止

F, in the browser input http://$IP 80 access, return a test interface.

3. Configure the HTTP server

The location of the default document path for Apache in CentOS is at/var/www/html, where the path to the configuration file is/etc/httpd/conf/httpd.conf. Other configurations are stored in the/etc/httpd/conf.d/folder.

Linux build HTTPS protocol for Tomcat and Apache servers

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.