Configuration of Aapache+2 tomcat8 in a CentOS environment, load balancing

Source: Internet
Author: User
Tags manual centos tomcat

1. First introduce Apache installation and uninstallation

installation, via Yum online

sudo yum install httpd-y

Set boot up

Chkconfig    httpd  on

Launch Apache Service

Service httpd Start  

The default installation path is:/etc/httpd/

Uninstalling Apache

First close the httpd service
/etc/init.d/httpd stop
list httpd related packages
rpm-qa|grep httpd
list packages as follows
Httpd-2.2.3-63.el5. Centos.1
httpd-manual-2.2.3-63.el5.centos.1
Uninstall package
rpm-e httpd-manual-2.2.3-63.el5.centos.1
rpm-e s Ystem-config-httpd-1.3.3.3-1.el5
This uninstall is done with the
uninstall of Apache
1, # Rpm-qa|grep httpd, view related packages with httpd.  
"Httpd-2.2.3-11.el5_2.centos.4
"
2, then delete httpd:
" # rpm-e httpd
"
There was a problem:
" error:failed dependencies:
httpd >= 2.2.0 is needed by (installed) gnome-user-share-0.10-6.el5.i386
"
3, there is also a related package not deleted, clear it, namely:
" #rpm-e G Nome-user-share
"
4, then delete httpd
" # rpm-e httpd
"
#可以使用参数 –nodeps means that regardless of the dependencies between the various packages.
"#rpm-e–nodeps httpd//So you don't need to delete gnome-user-share.
Let's configure Apache for static and dynamic separation, load balancing

Editing a configuration file

VI httpd.conf

Add at end

<!--load the required modules and, if necessary, add AJP modules to access tomcat-->
LoadModule proxy_module modules/mod_proxy.so 
LoadModule Proxy_http_module modules/mod_proxy_http.so 
LoadModule proxy_connect_module modules/mod_proxy_connect.so 
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
<!--If the default configuration file does not have the above configuration, add it directly, do not repeat the configuration, it will be wrong. -

<!--configure static and dynamic separation--

proxypassmatch/*.gif$! 
Proxypassmatch/*.jpg$!
Proxypassmatch/*.png$! 
Proxypassmatch/*.css$! 
Proxypassmatch/*.js$! 
Proxypassmatch/*.htm$! 
Proxypassmatch/*.html$! 

proxypass/balancer://cluster/ 
<proxy balancer://cluster/>  
balancermember http://127.0.0.1:8080/ Loadfactor=1
balancermember http://127.0.0.1:7080/loadfactor=1 <!--loadfactor Load Balancing-

Save to exit

Make sure that port 80 is not occupied before starting Apache. If it is occupied, it can be modified in the httpd.conf file.

CentOS environment, default installed Apache,
Static resource default configuration path:/var/www/html, can be modified in httpd.conf

You can use VIM to create an HTML static file for testing

2 installation of a TOMCAT8

1. Upload the tomcat Linux file locally via the Putty Tool PSCP command. Unzip to use

2. Use the VI command to modify the configuration file Server.xml and the Web. XML under the project, please refer to the WinDOS version of the TOMCAT8 to modify the content, configuration.

Related Article

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.