NGINX 리버스 프록시를 작동 시키려고 여러 시간 후 며칠 만 지난 후 여기에 첫 번째 게시물이 있습니다.NGINX 리버스 프록시 Namecheap을 통해 Subdomains에 대한 server_name을 확인하지 않음
나는 포트 80에 홈을 가리키는 Namecheap 서비스를 통해 여러 하위 도메인을 가지고 있고, 라우터/방화벽은 포트 80
하위 도메인을 내부의 nginx 역방향 프록시 서버를 가리키는 OpenWrt (CentOS는 7)를 실행 이 예를 들어 dokuwiki.namecheaptld.io하고 여기 내 주요 /etc/nginx.conf 파일입니다
을 observium.namecheaptld.io : 그 이전에 내가/등의 proxy_params 파일을 만든
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
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 /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
#listen [::]:80 default_server;
server_name _;
#root /usr/share/nginx/html;
# Load configuration files for the default server block.
#include /etc/nginx/default.d/*.conf;
#location/{
#}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
/nginx를 거기에 없었다 :
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
내가 내 /etc/nginx/conf.d/ 이름 dokuwiki.conf 및 observium.conf의 두 하위 도메인을 가지고
upstream dokuwiki {
server 192.168.1.6:8180;
}
server {
listen 80;
server_name dokuwiki.namecheaptld.io;
access_log /var/log/nginx/dokuwiki.access.log main;
error_log /var/log/nginx/dokuwiki.error.log;
location/{
proxy_pass http://192.168.1.6:8180;
include /etc/nginx/proxy_params;
}
}
upstream observium {
server 192.168.1.8:80;
}
server {
listen 80;
server_name observium.namecheaptld.io
access_log /var/log/nginx/observium.access.log main;
error_log /var/log/nginx/observium.error.log;
location/{
proxy_pass http://192.168.1.8:80;
include /etc/nginx/proxy_params;
}
}
내가 액세스하려고 할 때마다 하나 subdomain.namecheaptld.com, server_name 블록에 eith _ 또는 default_server가있는 정의 된 기본 가상 호스트가 제공됩니다.
proxy_pass 정의 된 IP 다음에 /var/log/nginx/dokuwiki.access.log에 오는 HTTP 헤더를 보았을 때 후행/추가를 포함하여 여러 가지를 시도한 후에 작동하지 않는 이유를 완전히 혼동합니다.
이 DokuWiki는 인 것처럼이 dokuwiki.namecheaptld.io 또는 observium.namecheaptld.io 중 하나의 요청을 복용하고 요청을 처리하는 것처럼 그래서 나는 그것이 192.168.1.11:80에서 수신 한 위의 헤더[22/Nov/2016:09:29:54 -0500] "GET/HTTP/1.1" 200 18273 "http://dokuwiki.namecheaptld.io/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36" "-"
[22/Nov/2016:09:29:54 -0500] "GET /lib/exe/indexer.php?id=start&1479824990 HTTP/1.1" 200 42 "http://MYEXTERNALIP/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36" "-"
[22/Nov/2016:09:29:57 -0500] "GET/HTTP/1.1" 200 18264 "http://observium.namecheaptld.io/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36" "-"
[22/Nov/2016:09:29:57 -0500] "GET /lib/exe/indexer.php?id=start&1479824994 HTTP/1.1" 200 42 "http://MYEXTERNALIP/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36" "-"
, 그것은 보인다 .namecheaptld.io
나는 도움이되지 않는 server_name 지시어에 명시 적 와일드 카드를 사용하려고했습니다.
응답 해 주셔서 감사합니다. 나는 사용할 수있는 사이트가 이제는 레거시라고 생각하고 vhost를 conf.d 디렉토리에 직접 저장하려고 생각 했습니까? 나는 NGINX의 현재 버전에 권장되는 것을 사용하도록 개방되어 있습니다. –