Linuxサーバーのバージョンを使用していますnginx-1.12.1-0+xenial0
。ここでは、次のように設定ファイルに2つのドメインを設定しましたが、ドメインを404 Not Found
開こうとするhttp://projecta.192.168.1.10.xip.io/
とエラーが発生します。
server {
listen 80;
index index.html index.htm index.nginx-debian.html;
server_name ~^(.*)192\.168\.1\.10\.xip\.io$;
set $file_path $1;
root /var/www/$file_path;
location / {
try_files $uri $uri/ =404;
}
error_log /var/log/nginx/error.log warn;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
}
}
nginx-debug.log
2017/08/25 14:32:47 [info] 13311#13311: *4 client closed connection while waiting for request, client: 192.168.1.10, server: 0.0.0.0:80
2017/08/25 14:32:47 [debug] 13311#13311: *4 close http connection: 13
2017/08/25 14:32:47 [debug] 13311#13311: *4 event timer del: 13: 1503651810686
2017/08/25 14:32:47 [debug] 13311#13311: *4 reusable connection: 0
2017/08/25 14:32:47 [debug] 13311#13311: *4 free: 00005561D7E90630
2017/08/25 14:32:47 [debug] 13311#13311: *4 free: 00005561D7E90420, unused: 136
2017/08/25 14:32:47 [debug] 13314#13314: accept on 0.0.0.0:80, ready: 0
2017/08/25 14:32:47 [debug] 13313#13313: accept on 0.0.0.0:80, ready: 0
2017/08/25 14:32:47 [debug] 13314#13314: posix_memalign: 00005561D7E90210:512 @16
2017/08/25 14:32:47 [debug] 13313#13313: accept() not ready (11: Resource temporarily unavailable)
2017/08/25 14:32:47 [debug] 13314#13314: *5 accept: 192.168.1.10:59958 fd:7
2017/08/25 14:32:47 [debug] 13312#13312: accept on 0.0.0.0:80, ready: 0
2017/08/25 14:32:47 [debug] 13314#13314: *5 event timer add: 7: 60000:1503651827272
2017/08/25 14:32:47 [debug] 13314#13314: *5 reusable connection: 1
2017/08/25 14:32:47 [debug] 13314#13314: *5 epoll add event: fd:7 op:1 ev:80002001
2017/08/25 14:32:47 [debug] 13312#13312: accept() not ready (11: Resource temporarily unavailable)
2017/08/25 14:32:47 [debug] 13312#13312: accept on 0.0.0.0:80, ready: 0
2017/08/25 14:32:47 [debug] 13311#13311: accept on 0.0.0.0:80, ready: 0
2017/08/25 14:32:47 [debug] 13314#13314: accept on 0.0.0.0:80, ready: 0
2017/08/25 14:32:47 [debug] 13311#13311: accept() not ready (11: Resource temporarily unavailable)
2017/08/25 14:32:47 [debug] 13312#13312: posix_memalign: 00005561D7E90210:512 @16
2017/08/25 14:32:47 [debug] 13314#13314: accept() not ready (11: Resource temporarily unavailable)
2017/08/25 14:32:47 [debug] 13312#13312: *6 accept: 192.168.1.10:59960 fd:12
2017/08/25 14:32:47 [debug] 13312#13312: *6 event timer add: 12: 60000:1503651827272
2017/08/25 14:32:47 [debug] 13312#13312: *6 reusable connection: 1
2017/08/25 14:32:47 [debug] 13312#13312: *6 epoll add event: fd:12 op:1 ev:80002001
2017/08/25 14:32:47 [debug] 13313#13313: *1 http keepalive handler
2017/08/25 14:32:47 [debug] 13313#13313: *1 malloc: 00005561D7E90420:1024
2017/08/25 14:32:47 [debug] 13313#13313: *1 recv: eof:0, avail:1
2017/08/25 14:32:47 [debug] 13313#13313: *1 recv: fd:9 482 of 1024
2017/08/25 14:32:47 [debug] 13313#13313: *1 reusable connection: 0
2017/08/25 14:32:47 [debug] 13313#13313: *1 posix_memalign: 00005561D7EA3BF0:4096 @16
2017/08/25 14:32:47 [debug] 13313#13313: *1 event timer del: 9: 1503651821000
2017/08/25 14:32:47 [debug] 13313#13313: *1 http process request line
2017/08/25 14:32:47 [debug] 13313#13313: *1 http request line: "GET / HTTP/1.1"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http uri: "/"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http args: ""
2017/08/25 14:32:47 [debug] 13313#13313: *1 http exten: ""
2017/08/25 14:32:47 [debug] 13313#13313: *1 posix_memalign: 00005561D7E9DBC0:4096 @16
2017/08/25 14:32:47 [debug] 13313#13313: *1 http process request header line
2017/08/25 14:32:47 [debug] 13313#13313: *1 http header: "Host: projecta.192.168.1.10.xip.io"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http header: "Connection: keep-alive"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http header: "Cache-Control: max-age=0"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http header: "Upgrade-Insecure-Requests: 1"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http header: "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http header: "Accept-Encoding: gzip, deflate, sdch"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http header: "Accept-Language: en-US,en;q=0.8"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http header: "Cookie: _jsuid=1316405163; _referrer_og=https%3A%2F%2Fwww.google.co.in%2F"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http header done
2017/08/25 14:32:47 [debug] 13313#13313: *1 generic phase: 0
2017/08/25 14:32:47 [debug] 13313#13313: *1 rewrite phase: 1
2017/08/25 14:32:47 [debug] 13313#13313: *1 http script complex value
2017/08/25 14:32:47 [debug] 13313#13313: *1 http script capture: "projecta."
2017/08/25 14:32:47 [debug] 13313#13313: *1 http script set $file_path
2017/08/25 14:32:47 [debug] 13313#13313: *1 test location: "/"
2017/08/25 14:32:47 [debug] 13313#13313: *1 test location: ~ "\.php$"
2017/08/25 14:32:47 [debug] 13313#13313: *1 using configuration "/"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http cl:-1 max:1048576
2017/08/25 14:32:47 [debug] 13313#13313: *1 rewrite phase: 3
2017/08/25 14:32:47 [debug] 13313#13313: *1 post rewrite phase: 4
2017/08/25 14:32:47 [debug] 13313#13313: *1 generic phase: 5
2017/08/25 14:32:47 [debug] 13313#13313: *1 generic phase: 6
2017/08/25 14:32:47 [debug] 13313#13313: *1 generic phase: 7
2017/08/25 14:32:47 [debug] 13313#13313: *1 access phase: 8
2017/08/25 14:32:47 [debug] 13313#13313: *1 access phase: 9
2017/08/25 14:32:47 [debug] 13313#13313: *1 access phase: 10
2017/08/25 14:32:47 [debug] 13313#13313: *1 access phase: 11
2017/08/25 14:32:47 [debug] 13313#13313: *1 post access phase: 12
2017/08/25 14:32:47 [debug] 13313#13313: *1 try files phase: 13
2017/08/25 14:32:47 [debug] 13313#13313: *1 http script copy: "/var/www/"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http script var: "projecta."
2017/08/25 14:32:47 [debug] 13313#13313: *1 http script var: "/"
2017/08/25 14:32:47 [debug] 13313#13313: *1 trying to use file: "/" "/var/www/projecta./"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http script var: "/"
2017/08/25 14:32:47 [debug] 13313#13313: *1 trying to use dir: "/" "/var/www/projecta./"
2017/08/25 14:32:47 [debug] 13313#13313: *1 trying to use file: "=404" "/var/www/projecta.=404"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http finalize request: 404, "/?" a:1, c:1
2017/08/25 14:32:47 [debug] 13313#13313: *1 http special response: 404, "/?"
2017/08/25 14:32:47 [debug] 13313#13313: *1 http set discard body
2017/08/25 14:32:47 [debug] 13313#13313: *1 xslt filter header
2017/08/25 14:32:47 [debug] 13313#13313: *1 HTTP/1.1 404 Not Found
Server: nginx/1.12.1
単純なHTMLページを開くことができない理由を知っている人はいますか?
コミュニティに感謝します!
ベストアンサー1
server_name
ホスト名の後のドットを削除するように変更する必要があります。
server_name ~^(.*)\.192\.168\.1\.10\.xip\.io$;
これにより、変数は現在の状態ではなく状態に$file_path
なります。projecta
projecta.