Home>Article>Backend Development> Configuring tomcat in Mac environment
When we view web pages on a MAC system, we generally use tomcat. This is because appache only supports static web pages, but dynamic web pages such as asp, php, cgi, jsp, etc. need tomcat to handle. So how to install tomcat in your MAC? Now I will teach you how to install it. Friends in need can refer to it.
Preface
I believe you know a little bit about Java Web, and you are generally familiar with Tomcat. Apache is an ordinary server and only supports HTML. That is, ordinary web pages can support PHP through plug-ins and can also be connected to Tomcat (one-way Apache connection to Tomcat, which means that Tomcat resources can be accessed through Apache. Tomcat cannot access Appache resources). Appache only supports static web pages, but dynamic web pages such as asp, php, cgi, jsp, etc. need Tomcat to handle them. Let’s take a look at the detailed steps below.
1. Download
Log in to the Apache Tomcat official website, click Download, and select the version you want to download.
2. Set the local placement path
Right-click Finder—>Go to folder —> In the ~/Library/ directory, unzip the downloaded package, then name it Tomcat and put it here.
Prevent Tomcat’s path
3. Start Tomcat
Open the terminal,cd /Users/apple/Library/Tomcat/bin
(Note: Switch to our Tomcat bin directory)
Open the terminal and enter "cd" "space", Then drag the bin folder to the terminal, enter quickly, click Enter
and then enter:./startup.sh
, press Enter, you can start our own Tomcat, as follows Picture:
Start successfully
Open our browser, and then enter the URLhttp://localhost:8080/
, if If a cat appears, it proves that the configuration is successful~
Instance interface
## 4. Close Tomcat
Also in the bin directory, enter in the terminal:./shutdown.sh and press Enter, that’s it.
Close Tomcat
5. Problems you may encounter during the configuration
1. After enteringstartup.shin the terminal, something like "Permission denied" appears. At this time, you need to set permissions on the directory: enter
sudo chmod 755 Library/Tomcat/bin/*.shPress Enter to set the read, write, and execute permissions for the file;
6. Tomcat directory structure and function
|- bin: stores tomcat commands. catalina.bat command: startup.bat-> catalina.bat start shutdown.bat- > catalina.bat stop | - conf: stores tomcat configuration information. The server.xml file is the core configuration file. |-lib: jar package that supports tomcat software running. There are also technical support packages, such as servlet, jsp |-logs: log information of the running process |-temp: temporary directory |-webapps: shared resources Table of contents. web application directory. (Note that it cannot be shared as a separate file) |-work: The running directory of tomcat. The temporary files generated when jsp is running are stored here |- WebRoot: the root directory of the web application |-Static resources (html css js image vedio) | -WEB-INF: Fixed writing method. |-classes: (optional) Fixed writing method. Store class bytecode files |-lib: (optional) Fixed writing method. Store jar package files. |-web.xmlNote:
1) The resources in the WEB-INF directory cannot be accessed through the browser Direct access 2) If you want to access the resources in WEB-INF, you must configure the resources into a file called web.xml.
The above is the detailed content of Configuring tomcat in Mac environment. For more information, please follow other related articles on the PHP Chinese website!