지금 당분간이 문제에 대한 해결책을 찾으려고했습니다. 하지만 아무 것도 작동하지 않는 것 같습니다.Nginx -받은 모든 요청은 동일한 웹 사이트로 이동합니다
모든 요청은 항상 동일한 웹 사이트 (첫 번째 웹 사이트는 ISPconfig에 구성되어 있습니다. 첫 번째 웹 사이트를 비활성화하면 두 번째 사이트로 이동합니다)가 문제가됩니다. 그것은 심지어 디폴트로 가지 않습니다.
이 문제를 조사한 결과, 아마도 nginx가 요청에 잘못된 호스트를 수신하고있는 것으로 나타났습니다 (도메인 공급자 dns 서버의 하위 도메인에 대해 cname이 있음).
는 그래서는 tcpdump를 실행,하지만 난 모든 요청이 실제로 정확하게 수신 사실을 발견[email protected]:/etc/nginx/sites-enabled# tcpdump -n -S -s 0 -A 'tcp dst port 80' | grep "Host"
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
Host: cartoes24.wagnerux.de
Host: cartoes24.wagnerux.de
Host: cartoes24.wagnerux.de
Host: test.wagnerux.de
Host: test.wagnerux.de
Host: test.wagnerux.de
내 가상 호스트 confs :
- cartoes24 가상 호스트 :
server {
listen 192.168.1.1:80;
server_name cartoes24.wagnerux.de;
root /var/www/cartoes24.wagnerux.de/web/;
index index.html index.htm index.php index.cgi index.pl index.xhtml;
error_page 400 /error/400.html;
error_page 401 /error/401.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 405 /error/405.html;
error_page 500 /error/500.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;
recursive_error_pages on;
location = /error/400.html {
internal;
}
location = /error/401.html {
internal;
}
location = /error/403.html {
internal;
}
location = /error/404.html {
internal;
}
location = /error/405.html {
internal;
}
location = /error/500.html {
internal;
}
location = /error/502.html {
internal;
}
location = /error/503.html {
internal;
}
error_log /var/log/ispconfig/httpd/cartoes24.wagnerux.de/error.log;
access_log /var/log/ispconfig/httpd/cartoes24.wagnerux.de/access.log combined;
location ~ /\. {
deny all;
}
location ^~ /.well-known/acme-challenge/ {
access_log off;
log_not_found off;
root /usr/local/ispconfig/interface/acme/;
autoindex off;
index index.html;
try_files $uri $uri/ =404;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location /stats/ {
index index.html index.php;
auth_basic "Members Only";
auth_basic_user_file /var/www/clients/client2/web1/web/stats/.htpasswd_stats;
}
location ^~ /awstats-icon {
alias /usr/share/awstats/icon;
}
location ~ \.php$ {
try_files /14d86c825b76b9bcc54ed6b1dbff2e23.htm @php;
}
location @php {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web1.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
location /cgi-bin/ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
root /var/www/clients/client2/web1;
gzip off;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
을 - 테스트 가상 호스트 :
server {
listen 192.168.1.1:80;
server_name cartoes24.wagnerux.de;
root /var/www/cartoes24.wagnerux.de/web/;
index index.html index.htm index.php index.cgi index.pl index.xhtml;
error_page 400 /error/400.html;
error_page 401 /error/401.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 405 /error/405.html;
error_page 500 /error/500.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;
recursive_error_pages on;
location = /error/400.html {
internal;
}
location = /error/401.html {
internal;
}
location = /error/403.html {
internal;
}
location = /error/404.html {
internal;
}
location = /error/405.html {
internal;
}
location = /error/500.html {
internal;
}
location = /error/502.html {
internal;
}
location = /error/503.html {
internal;
}
error_log /var/log/ispconfig/httpd/cartoes24.wagnerux.de/error.log;
access_log /var/log/ispconfig/httpd/cartoes24.wagnerux.de/access.log combined;
location ~ /\. {
deny all;
}
location ^~ /.well-known/acme-challenge/ {
access_log off;
log_not_found off;
root /usr/local/ispconfig/interface/acme/;
autoindex off;
index index.html;
try_files $uri $uri/ =404;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location /stats/ {
index index.html index.php;
auth_basic "Members Only";
auth_basic_user_file /var/www/clients/client2/web1/web/stats/.htpasswd_stats;
}
location ^~ /awstats-icon {
alias /usr/share/awstats/icon;
}
location ~ \.php$ {
try_files /14d86c825b76b9bcc54ed6b1dbff2e23.htm @php;
}
location @php {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web1.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
location /cgi-bin/ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
root /var/www/clients/client2/web1;
gzip off;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
- 기본 가상 호스트 : 서버 { 수신 대기 80 default_server; 이 질문에 이미 대답 경우
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
error_log /home/wagner/default_server_error.log;
return 444;
}
는 미안하지만 내가 찾은 모든 "솔루션"나를 위해 작동하지 않았다.
감사합니다.
'nginx -T'를 실행하고 출력을 붙여 넣기에 추가하고 질문에 링크를 게시하십시오. –
Hello Tarun, 문제점을 발견했습니다. ispconfig (내 서버에서 사용하고있는 것)에 문제가있었습니다. 가상 호스트 구성에 잘못된 IP 구성이 있습니다. 수정하려면 * 기호가 아닌 실제 서버 IP를 입력해야합니다. 그러면 작동합니다. 이 질문을 닫거나 삭제해야합니까? – user1903554
나는 당신이 당신 자신의 대답을 넣고이 문제를 설명 할 수 있다고 생각한다. 비슷한 실수를 저지를 사람을 도울 수 있습니다. –