Nginx 실전 도 메 인 이름 을 지정 한 서버 포트 로 변경
test. open. com 을 통 해 81 서버 가 지정 한 8081 포트 에 접근 합 니 다.
2. 적용:
2.1 먼저 클 라 우 드 서버 (여기 아 리 클 라 우 드 사용) 에서 open. com 의 1 급 도 메 인 이름 을 설정 합 니 다.
2.2 81 이 서버 에 nginx 를 설치 하고 nginx. conf 에서 설정 합 니 다. 설정 인 스 턴 스 는 다음 과 같 습 니 다.
access_log /web/logs/access.log main;
sendfile on;
#tcp_nopush on;
upstream tomcat_server {
server xxx.xx.xxx.81:8081 weight=1;
}
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name test.open.cn;
charset utf-8;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_pass http://tomcat_server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
http 요청 을 보 낼 때http://test.open.com먼저 1 급 도 메 인 이름 open. om 에 따라 xxx. xx. xxx. 81 서버 를 찾 은 다음 에 이 서버 에 nginx 를 설치 하고 80 포트 를 감청 (위 하 이 라이트) 했 습 니 다. 도 메 인 이름 이 test. open. cn 이라는 요청 이 오 면
변경 요청 을 location 로 지정 하고 location 의 속성 proxypass, tomcatserver (위의 upstream 은 xxx. xx. xxx. 81 로 지정) 마지막 으로 http: xxx. xx. xxx. 81 로 바 뀌 었 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.