Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Nginx+SSL+Tomcat configure SSL certificates

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to configure SSL certificates in Nginx+SSL+Tomcat". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Nginx+SSL+Tomcat how to configure SSL certificate" bar!

The following solution is to use HTTPS to communicate between the browser and Nginx, while Nginx to Tomcat uses a standard HTTP connection through proxy_pass.

The detailed configuration file is as follows (tomcat port 80 Nginx 443 tomcat port 8080):

Nginx front-end SSL profile:

Upstream tomcat {

Server 127.0.0.1:8080 fail_timeout=0

}

# HTTPS server

Server {

Listen 443 ssl

Server_name localhost

Ssl_certificate / Users/SSL/chinassl.crt

Ssl_certificate_key / Users/SSL/chinassl.key

Ssl_session_cache shared:SSL:1m

Ssl_session_timeout 5m

Ssl_ciphers HIGH:!aNULL:!MD5

Ssl_prefer_server_ciphers on

Location / {

Proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for

Proxy_set_header Host $http_host

Proxy_set_header X-Forwarded-Proto https

Proxy_redirect off

Proxy_connect_timeout 240

Proxy_send_timeout 240

Proxy_read_timeout 240

# note, there is not SSL here! Plain HTTP is used

Proxy_pass http://tomcat;

}

}

The most important of these are ssl_certificate and ssl_certificate_key, and the rest are configured normally. But there is an extra proxy_set_header X-Forwarded-Proto https; configuration.

For the backend Tomcat, the configuration file is as follows:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report