In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)05/31 Report--
How to enable HTTPS, for this question, this article introduces in detail the corresponding analysis and answers, hoping to help more partners who want to solve this problem to find a more simple and easy way.
How to enable HTTPS
I. preparatory work
One server (you can buy Aliyun lightweight application server, which is cheaper)
SSL certificate (you can register for Aliyun free certificate with poor security)
One domain name (can be purchased on Wanwang and need to be put on record)
Locally packaged projects (the blogger is developed using springboot, so the packaged jar package is not the war package)
Ftp client
First of all, set up the environment on the server (database, jdk, etc.), because the demonstration project is built by SpringBoot and has a built-in running container, so you don't need Tomcat.
1) SSL certificate
You can apply for a free version of the SSL certificate on Aliyun, or you can visit the FreeSSL website to register a free certificate.
2) after the domain name is filed successfully, it needs to be resolved.
Go to the Aliyun console and enter the domain name management
3) Click the certificate application in this area after the parsing is completed, and fill in the relevant information
After the application is reviewed, you can click to download it.
4) inject ServletWebServerFactory
Inject ServletWebServerFactory into the startup class in our SpringBoot project:
@ Bean public ServletWebServerFactory servletContainer () {TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory (); tomcat.addAdditionalTomcatConnectors (createHTTPConnector ()); return tomcat;} private Connector createHTTPConnector () {Connector connector = new Connector ("org.apache.coyote.http11.Http11NioProtocol"); / / enable both http (8080) and https (8866) connector.setScheme ("http"); connector.setSecure (false); connector.setPort (8080); connector.setRedirectPort (8866); return connector;}
Then add to the application.properties configuration file
Notice here that it's server.ssl.key-store-password, not server.ssl.key-password.
5) package the project
Put your packaged projects and downloaded certificates under the usr/develop/project folder, and you can choose the folder directory.
For convenience, I have created several scripts for easy running.
Vim start.sh
Create a startup script as follows:
Nohup java-jar's own project name. Jar &
Vim stop.sh
Create a stop script as follows:
PID=$ (ps-ef | grep's own project name. Jar | grep-v grep | awk'{print $2}') if [- z "$PID"] then echo Application is already stopped else echo kill $PID kill-9$ PID fi
Vim run.sh
Set up and run the script as follows
Echo stop application source stop.sh echo start application source start.sh
Then enter. / run.sh at the terminal. If prompted without permission, enter
Chmod uplix * .sh
Then type. / run.sh so that our program starts, and then we can access our project through the https:// domain name: Port number on the browser.
This is the answer to the question on how to enable HTTPS. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel to learn more about it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.