Tomcat -- About Project Configuration
-
Configuration Ports - involving three ports - modifying conf/server.xml
# Close the port of tomcat <Server port="8005" shutdown="SHUTDOWN"> # Establish access to http, browser access <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> # Used for communicating with other http servers <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> # You can remove comments, set the number of threads, the number of threads already named format <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/>
-
Configure Project Domain Name Running - Modify conf/server.xml
# Default Host modifies here <Engine name="Catalina" defaultHost="www.test.com"> # To modify the name, you need to be the same as above, appBase - where the project is placed <Host name="www.test.com" appBase="webapps" unpackWARs="true" autoDeploy="true"> # Add the code, specify the access item, and modify the value of docBase. The access item is http://127.0.0.1:8080. # If not, visit the project: http://127.0.0.1:8080/project folder name or war package name <Context docBase="htmlMain" path="" reloadable="true"/>
-
Setting up local servers allows access to external machines - if external machines could have access, no settings - for centos6, if it's a desktop version, you can add open ports directly to the firewall.
- If the firewall comes with it, centos is firewalld, which is used as follows
# View firewall service status systemctl status firewalld # View the status of firewall firewall-cmd --state # open service firewalld start # restart service firewalld restart # Close service firewalld stop # View firewall rules firewall-cmd --list-all #View the open ports of the firewall firewall-cmd --permanent --list-ports # Is the query port open? firewall-cmd --query-port=8080/tcp # Open 80 ports and 8080-8085 ports firewall-cmd --permanent --add-port=80/tcp firewall-cmd --permanent --add-port=8080-8085/tcp # Remove port firewall-cmd --permanent --remove-port=8080/tcp #Restart firewall (restart firewall after configuration modification) firewall-cmd --reload
- Install a new firewall
# Look at the local iptables version, some have been installed and can be ignored iptables -V # Install iptables yum install iptables -y # Open the specified port for external access to 8089 iptables -I INPUT -p tcp --dport 8089 -j ACCEPT # Save rules to system configuration service iptables save # View state service iptables status # Close Firewall Service service iptables stop # Restart Firewall Service service iptables restart # Empty rules, use cautiously iptalbes -F # Shielding a single IP iptables -I INPUT -s xxx.xxx.xxx.xxx -j DROP # Unencapsulation of a single IP iptables -D INPUT -s xxx.xxx.xxx.xxx -j DROP