Home>Article>Backend Development> Configuring tomcat in Mac environment

Configuring tomcat in Mac environment

不言
不言 Original
2018-06-02 09:58:40 2721browse

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 entering

startup.shin the terminal, something like "Permission denied" appears. At this time, you need to set permissions on the directory: entersudo chmod 755 Library/Tomcat/bin/*.shPress Enter to set the read, write, and execute permissions for the file;

Explanation: sudo is usually the system super administrator 755, which means that the user has read, write, and execute permissions for the file. Other people in the same group have execution and execution permissions. There is read permission but no write permission. The permissions of other users are the same as those of people in the same group. 777 represents that user, group, and others all have read, write, and executable permissions.

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.xml

Note:

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn