Install Apache Tomcat under Mac

Source: Internet
Author: User
Tags apache tomcat

CatalogueFirst, the default version: Two, custom download configuration version:

——————————————————————— Body ——————————————————————————

First, the default version:# #一, Mac comes with Apach, only need to turn on: (This is also the display version of the instructions)

Open terminal, input:sudo apachectl-v

Enter confirmation, the version of Apach will be displayed

For example, my Mac Pro's

1 Server version:apache/2.4.  - (Unix) 2 3 Server built:    £ º

# #二, open Apach

Terminal input

sudo apachectl start

Enter confirm, open localhost in the browser, if the display "it works" is to open Apache success.

It is located under/library (Resource Library)/webserver/documents/ , which is the default root directory for Apache.

Apache installation directory in:/etc/apache2/,etc is hidden by default. There are three ways of viewing:

    1. Right-click Finder under the Dock, Select " go to Folder "and enter "/etc"
    2. In the finder -----Go to the folder and enter/ etc
    3. You can enter "Open/etc" in terminal

# #三. Change the Apache configuration (such as the file displayed on the home page)

1. Open /etc/apache2/httpd.conf"

<ifmodule dir_module>

DirectoryIndex index2.html//This changes to the file you want to display (of course, first, this folder must have this file)

</IfModule>

2. Then restart Apache to take effect

Sudo

Second, custom download configuration version:

We can go to Apache Tomcat and download different versions of Tomcat and install it on your Mac.

# #一,:

http://tomcat.apache.org

on the left download select the Tomcat version you want to download, for example, I'm under Tomcat 8.  

# #二, install:

1. Unzip, find a place to put it. I put it under the application.

2. Add the bin directory to the environment variable (not required), if you do not configure environment variables, each time you start Tomcat to advanced to the bin directory, just a bit of trouble.

Specific practices: finder→ go to folder → Enter ~→ return confirmation → open. bash_profile→ Add the following code and save the exit:

Export path= $PATH: Your tomcat's Bin directory

For example in my case:

Export path= $PATH:/applications/apache-tomcat-8.0.33/bin

# #三, start Tomcat:

After the 2 steps above, Tomcat is ready to go, and now it can be started.

If you do not add the bin directory to the environment variable, then you need to open the terminal, through the CD XXXX advanced to the Tomcat Bin directory, and then enter: startup.sh carriage return.

Then open the browser, enter localhost:8080, (8080 is the default port number, the following will explain how to modify the port number) you will see the following page:

# #四, some of the other common tomcat operations:

1. Turn tomcat off: Go into the bin directory, shutdown.sh

2. Display the Tomcat version number: In the bin directory, catalina.sh version

# #五, problems you may encounter when you start Tomcat:

1. Input startup.sh Enter after the display: command not found, that change into the input bash startup.sh can, normally, the terminal will display the following information:

1Tydemacbook-pro:bin ty$ startup.SH2 3-bash:startup.SH: Command not found4 5Tydemacbook-pro:bin ty$Bash startup.sh <← to this sentence, then enter, the following message will be displayed, indicating that the tomcat> has been started6 7Using catalina_base:/applications/apache-tomcat-8.0. -8 9Using Catalina_home:/applications/apache-tomcat-8.0. -Ten  OneUsing Catalina_tmpdir:/applications/apache-tomcat-8.0. -/Temp A  -Using jre_home:/library/java/javavirtualmachines/jdk1.8.0_40.jdk/contents/Home -  theUsing CLASSPATH:/applications/apache-tomcat-8.0. -/bin/bootstrap.jar:/applications/apache-tomcat-8.0. -/bin/tomcat-Juli.jar -  -Tomcat started. 

Same error, applicable to other execution SH commands, plus bash in front

Install Apache Tomcat under Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.