Apache Tomcat installation configuration in Mac system

Source: Internet
Author: User
Tags chmod ini php file tomcat apache tomcat

Apache is a common server, itself only supports HTML that is normal Web pages, you can support PHP through Plug-ins, but also with Tomcat connectivity (one-way Apache connection Tomcat, that is, through Apache access to Tomcat resources.) Tomcat cannot access the Appache resource). Appache only supports static Web pages, but dynamic like asp,php,cgi,jsp requires Tomcat to handle them. For Apache Tomcat estimated a lot of children's shoes will be, so today's simple to say on the Mac on the installation of Tomcat;

I downloaded it yesterday. Tomcat thought it was going to be done soon, but there were some pits, simple introduction to the installation process:

1. Download Tomcat

Mac downloads zip and tar.gz are all OK, I downloaded the tar.gz

2. After compression directly copy to the repository, the compressed folder name is TOMCAT8, the specific location is as follows:

3. Open the terminal, enter the following command library/tomcat8/bin/startup.sh, the browser input localhost:8080, you can see the effect:

If you are experiencing prompt no such file or directory error prompts, you need to perform the sudo chmod 755 library/tomcat/bin/*.sh, Then rerun startup.sh, and if you want to stop Tomcat, execute shutdown.sh directly. When you execute sudo, you must use a user with a password. If each write path is troublesome, you need to set the environment variable at this time.

4. Set TOMCAT environment variables:

① input touch. Bash_profile (pico. Bash_profile)

② Open Bash_profile open-e bash_profile (nano. Bash_profile also)

③ Enter Export path= $PATH:/users/keso/library/tomcat8/bin

④ updates the configured environment variable source. bash_profile

⑤ Verify success, enter $path in terminal

Displays the following-bash:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/users/keso/library/tomcat8/bin:no such file or directory

5. The input startup.sh in the terminal, startup.sh appears similar to "Permission denied", this time needs to the directory permission setting: input sudo chmod 755 the library/tomcat8/bin/*.sh returns, Set file read and write permissions;

6. After the setup is complete, startup.sh will display the startup:

7. Close the need to use shutdown.sh can be;

Digression: sudo is usually the system Super Administrator 755 on behalf of the user on the file has read, write, execute permissions, other members of the same group have the right to execute and read, there is no write permission, the other user's permissions and the same group of people's permissions. 777 delegates, User,group, others, all have read-write and executable permissions.

Manage Apache with Mac OS Self

  Mac OS X built in Apache and PHP

Management method One:

Open System settings preferences (systems Preferences)-> share (sharing)-> Web share (web sharing)

Management Method Two:

Start Apache: Run "sudo apachectl start" and enter the root account password

Stop Apache: Run "sudo apachectl stop",

View Apache: Version: Run "sudo apachectl-v",

Reboot Apache: Run "sudo apachectl restart"

  Default location of Apache files in Mac os

Mac OS's Apache2 configuration file (Httpd.config) is saved in/etc/apache2

Mac OS's Apache2 Program Files (httpd, AB) are saved in/usr/sbin/

Default root directory for Mac OS Apache2:/library/webserver/documents

Modify the Apache2 configuration file, run "sudo vi/etc/apache2/httpd.conf" on the terminal, and open the Apche configuration file for modification.

Modify hosts configuration in Mac OS

Run "sudo vi/etc/hosts", open the hosts configuration file, can be native DNS solution.

  Mac OS self-with Apache AB stress test Tool description

MAC OS has a apache2.2.22, the matching AB test tool is not working and cannot be used.

So March 25, 2012, a new Apache 2.4.1 was installed in/usr/local/apache.

And the/usr/local/apache/bin/ab copy to the/usr/sbin/ab, covering the original AB.

The AB version is 2.3, and the trumpet is different. Now the AB Test tool works.

  Mac OS running PHP

Run "sudo vi/etc/apache2/httpd.conf" in the terminal to open the Apache configuration file.

Find the "#LoadModule php5_module libexec/apache2/libphp5.so", remove the front #, Save and Exit VI (enter at the command line: WQ).

Run "sudo cp/etc/php.ini.default/etc/php.ini" so that you can run sudo vi/etc/php.ini to edit php.ini configuration features. Like what:

Java code

, use the following two items to adjust the maximum value of the PHP submission file, such as the maximum value of the imported data in phpMyAdmin

Upload_max_filesize = 2M

Post_max_size = 8M

Display_errors to control whether or not to display error messages for PHP programs, which is useful when debugging PHP programs

Display_errors = Off

Run "sudo apachectl restart" and restart Apache so that PHP can be used.

Run "sudo cp/library/webserver/documents/index.html.en/library/webserver/documents/info.php", That is, copy the Index.html.en file in the root directory of Apache and rename it to info.php.

Run "sudo vi/library/webserver/document/info.php" in the terminal so that you can edit the info.php file in VI.

In "It ' s works!" Then add "" and save it. This allows you to see information about PHP in http://localhost/info.php, such as the 10.8 built-in PHP version number 5.3.13.

  MAC OS terminal color

Modify the ~/.bash_profile file to include the following lines of configuration in the file.

# for Color

Export Clicolor=1

# h:w u$

Export ps1= ' [33[01;33m]u@h[33[01;31m] w$[33[00m] '

# grep

Alias grep= ' grep--color=always '

  MAC OS Installation Nginx

Install Nginx pcre, zlib library, my system has taken these.

However, when using the pcre from the system, make Nginx an error:

-lpcre-lcrypto-lcrypto-lz

Undefined Symbols for Architecture x86_64:

"_pcre_free_study", referenced from:

_ngx_pcre_free_studies in NGX_REGEX.O

Ld:symbol (s) not found for architecture x86_64

Collect2:ld returned 1 exit status

MAKE[1]: * * * [Objs/nginx] Error 1

Make: * * * [build] Error 2

I am using the Brew Package Manager (not like ports) on this computer

Reinstalling Pcre (Brew install pcre) using the Brew Package management tool does not resolve the problem.

and unloaded the pcre.

Manually install Pcre, also not.

can only according to the material official said, installs the Mac ports, then uses the port to install Pcre.

sudo port install Pcre

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.