Tomcat configuration https port 8080 becomes forced jump jump 80 or 443 8443

Tomcat configuration becomes mandatory https port 8443

Jump ports:
HTTP default port 8080
HTTPS default port 8443

or

http default port 80
HTTPS default port 443
where they talk about tomcat configuration, as certificate generation refer to other documents;
modify tomcat configuration file vim /etc/tomcat/server.xml enable ssl

service.xml
    <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

    <Connector port="8443" protocol="HTTP/1.1"
                SSLEnabled="true"
                maxThreads="150" 
                scheme="https" 
                secure="true"
                keystoreFile="/usr/ca/server/server.keystore.jks"
                keystorePass="yzd2019"
                clientAuth="false" 
                sslProtocol="TLS" 

Forced Jump:
Visit http 8080 or 80 automatically jump
to modify web.xml

在welcome-file-list标签后加入
<login-config>  
        <!-- Authorization setting for SSL -->  
        <auth-method>CLIENT-CERT</auth-method>  
        <realm-name>Client Cert Users-only Area</realm-name>  
    </login-config>  
    <security-constraint>  
        <!-- Authorization setting for SSL -->  
        <web-resource-collection >  
            <web-resource-name >SSL</web-resource-name>  
            <url-pattern>/*</url-pattern>  
        </web-resource-collection>  
        <user-data-constraint>  
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>  
        </user-data-constraint>  
    </security-constraint> 

Tomcat configuration https port 8080 becomes forced jump jump 80 or 443 8443
Note: If you are YUM installed tomcat can not use ports below 1024 fixing can not use 80 and 443;
if modifications listening port 80 off to modify tomcat run user root; safety official is not recommended to do it;
modify the following tomcat users root
vim /usr/lib/systemd/system/tomcat.service

# Systemd unit file for default tomcat
# 
# To create clones of this service:
# DO NOTHING, use [email protected] instead.

[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=simple
EnvironmentFile=/etc/tomcat/tomcat.conf
Environment="NAME="
EnvironmentFile=-/etc/sysconfig/tomcat
ExecStart=/usr/libexec/tomcat/server start
SuccessExitStatus=143
# User=Tomcat
User=root

[Install]
WantedBy=multi-user.target

Guess you like

Origin blog.51cto.com/37003839/2427385