Window Nginx + JBoss 부하 배치 웹
5456 단어 window
1. Nginx 홈 페이지 에서 최신 안정 버 전 을 다운로드 하고 설치 배치 (생략...).
2. Nginx 프로필 nginx - 1.8.0 \ conf 의 nginx. conf 파일 을 수정 합 니 다.다음 을 참고 하 십시오.
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# JBoss
upstream localhost {
server 127.0.0.1:8787;
server 127.0.0.1:8070;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
# location,
location / {
proxy_connect_timeout 3;
proxy_send_timeout 30;
proxy_read_timeout 30;
proxy_pass http://localhost;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
#}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
프로필 은 한 곳 만 추가 하고 한 곳 만 수정 합 니 다.
1. upstream localhost 를 추가 하여 여러 개의 JBoss 를 설정 할 수 있 습 니 다. 전에 JBoss 포트 를 바 꾼 적 이 있 기 때문에 테스트 도 가 져 왔 습 니 다.
# JBoss
upstream localhost {
server 127.0.0.1:8787;
server 127.0.0.1:8070;
}
2. 원래 의 location 을 다음 과 같이 수정 합 니 다.
# location,
location / {
proxy_connect_timeout 3;
proxy_send_timeout 30;
proxy_read_timeout 30;
proxy_pass http://localhost;
}
3. 정상적으로 웹 하 나 를 JBoss 에 배치 하면 저 는 웹 프로젝트 의 예 를 간단하게 썼 습 니 다. 프로젝트 이름 은 Nginx 1 입 니 다.
index. jsp 의 내용 을 This is my JSP 1 페이지 로 수정 합 니 다. 포트 8787 인 JBoss 에 war 패키지 로 배치 하기;
index. jsp 의 내용 을 This is my JSP 2 페이지 로 수정 합 니 다. 그리고 war 패키지 로 포트 8070 의 JBoss 에 배 치 됩 니 다. 가운데 4. 두 개의 JBoss 를 시작 하여 발 표 된 웹 프로젝트 에 문제 가 있 는 지 검증 합 니 다.
1. 방문http://localhost:8787/Nginx1/index.jsp결 과 는 다음 그림 과 같 습 니 다. 문제 없습니다.
2. 방문http://localhost:8070/Nginx1/index.jsp결 과 는 다음 그림 과 같 습 니 다. 문제 없습니다.
두 방문 이 모두 정상 입 니 다. 그러면 우 리 는 지금부터 Nginx 프 록 시 를 사용 하면 어떻게 되 는 지 검증 합 니 다.
5. doc 를 사용 하여 Nginx 설치 디 렉 터 리 로 전환 하고 start nginx. exe 를 입력 하여 nginx 를 시작 하고 접근 합 니 다. http://localhost/Nginx1/index.jsp, 첫 방문: (nginx 기본 감청 포트 는 80)
다시 한 번 갱신:
이로써 서로 다른 JBoss 서 비 스 를 상당히 방문 하 는 방식 으로 리 셋 하면 서비스의 스트레스 를 줄 이 고 부하 균형 을 이 룰 수 있다 는 큰 성 과 를 거 두 었 다.이 예 는 매우 간단 해서 입문 하여 이해 할 수 있 는 예 로 삼 을 수 있다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
TIL - Window global object자바스크립트가 돌아가는 플랫폼은 호스트(host) 라고 불립니다. 호스트는 브라우저, 웹서버, 심지어는 커피 머신이 될 수도 있습니다. 각 플랫폼은 해당 플랫폼에 특정되는 기능을 제공하는데, 자바스크립트 명세서에선 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.