nginx + tomcat7 configure cluster environment
Configure tomcat7 normally in CentOS linux
Start tomcat7, The access address is:
192.168.1.207:8080
192.168.1.208:8080
- Download the relevant version of nginx at the following address: http://nginx.org/en/download.html. I personally use nginx-1.6.2.tar.gz
- Upload the nginx installation file to the linux server.
- Execute the command to decompress: tar -zxvf nginx-1.6.2.tar.gz
- The necessary related package commands to install nginx:
- yum install -y pcre-devel openssl-devel
- yum install gcc-c++
Configure the nginx installation environment:
Execute the following command:
- cd nginx-1.6.2
- ./configure --with-http_stub_status_module --with-http_ssl_module
If the following information appears, it means the installation environment is configured successfully.
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/ logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
Install nginx
Execute command: make && make install
The following information appears to indicate successful installation:
test -f '/usr/local/nginx/conf/nginx.conf' || cp conf/nginx.conf '/usr/local/nginx/conf /nginx.conf'
cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/logs' || mkdir -p ' /usr/local/nginx/logs'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/ nginx/html' || cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs '
make[1]: Leaving directory `/web/nginx-1.6.2'
Start: /usr/local/nginx/sbin/nginx
Close: /usr/local/nginx/sbin/nginx - s stop
Restart nginx service:/usr/nginx/sbin/nginx -s reload
ConfigurationnginxLoad balancing
execution Command: vi /usr /local/nginx/sbin/nginx/conf/nginx.conf
modified to:
worker_processes 2;
The above introduces nginx + tomcat7 configuration cluster environment, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet -stream;
sendfile on;
keepalive_timeout 65;
#start
upstream 192.168.1.208{
#solve the session problem
ip_hash;
server 192.168.1.207:8080 weight=1;
server 192.168.1.208:8080 weight=1;
}
#end server {
listen 80;
server_name 192.168.1.2 08;
location / {
root html;
index index.html index. htm; 请 #Request to the server list defined by mysvr
Proxy_pass http: //192.168.1.208;
proxy_redirect default; seconds, when one server crashes, it will be forwarded to another server after 10 seconds. C proxy_connect_timeout 10;
} error_page 500 502 503 504 /50x.html ; local = /50x.html {
root html; Start the nginx service,
Visit http://192.168.1.208/application name

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to configure an Nginx domain name on a cloud server: Create an A record pointing to the public IP address of the cloud server. Add virtual host blocks in the Nginx configuration file, specifying the listening port, domain name, and website root directory. Restart Nginx to apply the changes. Access the domain name test configuration. Other notes: Install the SSL certificate to enable HTTPS, ensure that the firewall allows port 80 traffic, and wait for DNS resolution to take effect.

The methods that can query the Nginx version are: use the nginx -v command; view the version directive in the nginx.conf file; open the Nginx error page and view the page title.

Starting an Nginx server requires different steps according to different operating systems: Linux/Unix system: Install the Nginx package (for example, using apt-get or yum). Use systemctl to start an Nginx service (for example, sudo systemctl start nginx). Windows system: Download and install Windows binary files. Start Nginx using the nginx.exe executable (for example, nginx.exe -c conf\nginx.conf). No matter which operating system you use, you can access the server IP

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

How to confirm whether Nginx is started: 1. Use the command line: systemctl status nginx (Linux/Unix), netstat -ano | findstr 80 (Windows); 2. Check whether port 80 is open; 3. Check the Nginx startup message in the system log; 4. Use third-party tools, such as Nagios, Zabbix, and Icinga.

How to configure Nginx in Windows? Install Nginx and create a virtual host configuration. Modify the main configuration file and include the virtual host configuration. Start or reload Nginx. Test the configuration and view the website. Selectively enable SSL and configure SSL certificates. Selectively set the firewall to allow port 80 and 443 traffic.

To deploy a JAR program on Nginx, seven steps need to be followed: 1) Install JRE, 2) Install Nginx, 3) Configure Nginx, 4) Deploy JAR, 5) Grant execution permissions, 6) Restart Nginx, 7) Verify deployment.

To get Nginx to run Apache, you need to: 1. Install Nginx and Apache; 2. Configure the Nginx agent; 3. Start Nginx and Apache; 4. Test the configuration to ensure that you can see Apache content after accessing the domain name. In addition, you need to pay attention to other matters such as port number matching, virtual host configuration, and SSL/TLS settings.
