In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Centos7 tomcat installation and tomcat web hosting
tomcat download URL:
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.31/bin/apache-tomcat-8.5.31.tar.gz
Download URL:
wget https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz
1. First install an upload software
yum install lrz* -y (custom use)
2. Software packages such as:
3. Install JAVA environment variables
tar xf jdk-8u144-linux-x64.tar.gz extract package
cp -rv jdk1.8.0_144/usr/local/java Install JAVA
vi /etc/profile
Insert the following at the end:
export JAVA_HOME=/usr/local/java
export JRE_HOME=/usr/local/java/jre
export PATH=$PATH:/usr/local/java/bin
export CLASSPATH=./:/ usr/local/java/lib:/usr/local/java/jre/lib
:wq Save Exit
source /etc/profile for configuration to take effect
java -version Check if java environment variables are installed successfully (success is shown in the screenshot below)
Install tomcat
tar xf apache-tomcat-8.5.23-embed.tar.gz extract tomcat package
cp -r apache-tomcat-8.5.23 /usr/local/tomcat8 Install tomcat
cd /usr/local/tomcat8/
bin holds startup and shutdown tomcat scripts
conf contains different configuration files, server.xml (Tomcat's main configuration file) and web.xml
lib holds jar packages needed for Tomcat to run or sites to run, and all sites on this Tomcat share these jar packages.
Work stores the class files generated by jsp compilation
webapp stores application examples, and applications you want to deploy in the future should also be placed in this directory, which can be changed.
logs store log files
LICENSE: Licence.
NOTICE: Description document.
Soft links to startup files, soft links to close files directly:tomcatup startup and tomcatdown close
ln -s /usr/local/tomcat8/bin/startup.sh /usr/bin/tomcatup
ln -s /usr/local/tomcat8/bin/shutdown.sh /usr/bin/tomcatdown
tomcatup startup tomcat startup success effect diagram as follows
netstat -anpt |grep 8080 Check if tomcat starts successfully and works on port 8080
Web Testing
systemctl stop firewall
setenforce 0
Enter: 192.168.80.100:8080(IP address) or www.centos.com:8080(URL) in the browser address bar (successful screenshot below)
The above shows that your tomcat is installed and running on port 8080
tomcat web hosting
vi /usr/local/tomcat8/conf/server.xml
Add multiple hosts Add new content below each as shown below
property specification
name: localhost virtual host name in $CATALINA_HOME/config/Catalina/localhost is always emphasized in this example
debug: is the debug level of the log
appBase: The default app path, i.e. putting the app in a directory and automatically deploying the app if autoDeploy is true. This path is relative to $CATALINA_HOME/ (base directory for web applications).
unpackWARs: Set to true, in Web apps as *.war Yes, unpack this WAR file. If true, tomcat will automatically extract the WAR file; otherwise, run the application directly from the WAR file without extracting it.
autoDeploy: true by default, means that if a new WEB application is put into appBase and Tomcat is running, the application will be automatically loaded
path: The URI to access, e.g. http://localhost/is the root directory of my app, accessing this app will operate with http://localhost/demm, this element must be the prefix of the URL representing this web application to match a Context. The requested URL//localhost: 8080/path/* was not found on this server.
docBase:WEB directory of the application, this directory must comply with the Java WEB application specification, the file storage path of the web application or the WAR file storage path.
debug: log level
reloadable: whether to reload when the program has changed, set to true affects performance, but automatically loads modified files,
If true, Tomcat will support hot deployment, automatically detect changes to the web application's/WEB-INF/lib and/WEB-INF/classes directories, automatically load new JSPs and servlets, and we can change the web application without restarting Tomcat
The requested URL/webapp/was not found on this server.
Create a java page for.jsp with the following content
vi index.jsp
JSP test page
:wq Save Exit
Tip: every time modify or add and delete a series of actions after the operation as far as possible to close (tomcatdown)tomcat and then start tomcat(tomcatup) or easy to go wrong
Testing tomcat virtual hosting
Windows 7 test results are as follows
Linux test
curl http://www.centos.com:8080
If the above effect is achieved, your tomcat virtual host has been successfully configured
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.