Hallo Zusammen,
ich habe eine minimale Flask Anwendung im Dockercontainer laufen. Diese läuft auf dem Port 5000 und ist von meinem Rechner mit
http://localhost:5000 erreichbar. Nun wollte ich mal mittels nginx diese Anwendung unter
http://localhost/flask erreichbar machen.
Dazu habe ich natürlich flask installiert und wie folgt konfiguriert
/etc/nginx/nginx.conf:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
include /etc/nginx/proxy_params;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;
gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
listen 80;
location /flask/ {
proxy_pass "http://127.0.0.1:5000";
}
}
}
|
Leider wird beim Aufruf von
http://localhost/flask ein 404 geliefert
access.log
|
Quellcode
|
1
|
127.0.0.1 - - [01/Sep/2019:18:15:57 +0200] "GET /flask HTTP/1.1" 404 152 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
|
error.log
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
2019/09/01 18:17:37 [debug] 19339#19339: *5 http keepalive handler
2019/09/01 18:17:37 [debug] 19339#19339: *5 malloc: 0000560FB165D7F0:1024
2019/09/01 18:17:37 [debug] 19339#19339: *5 recv: eof:0, avail:1
2019/09/01 18:17:37 [debug] 19339#19339: *5 recv: fd:10 357 of 1024
2019/09/01 18:17:37 [debug] 19339#19339: *5 reusable connection: 0
2019/09/01 18:17:37 [debug] 19339#19339: *5 posix_memalign: 0000560FB1673F80:4096 @16
2019/09/01 18:17:37 [debug] 19339#19339: *5 event timer del: 10: 26395528
2019/09/01 18:17:37 [debug] 19339#19339: *5 http process request line
2019/09/01 18:17:37 [debug] 19339#19339: *5 http request line: "GET /flask HTTP/1.1"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http uri: "/flask"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http args: ""
2019/09/01 18:17:37 [debug] 19339#19339: *5 http exten: ""
2019/09/01 18:17:37 [debug] 19339#19339: *5 posix_memalign: 0000560FB16BC000:4096 @16
2019/09/01 18:17:37 [debug] 19339#19339: *5 http process request header line
2019/09/01 18:17:37 [debug] 19339#19339: *5 http header: "Host: localhost"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http header: "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http header: "Accept-Language: de,en-US;q=0.7,en;q=0.3"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http header: "Accept-Encoding: gzip, deflate"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http header: "Connection: keep-alive"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http header: "Upgrade-Insecure-Requests: 1"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http header: "Cache-Control: max-age=0"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http header done
2019/09/01 18:17:37 [debug] 19339#19339: *5 generic phase: 0
2019/09/01 18:17:37 [debug] 19339#19339: *5 rewrite phase: 1
2019/09/01 18:17:37 [debug] 19339#19339: *5 test location: "/"
2019/09/01 18:17:37 [debug] 19339#19339: *5 using configuration "/"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http cl:-1 max:1048576
2019/09/01 18:17:37 [debug] 19339#19339: *5 rewrite phase: 3
2019/09/01 18:17:37 [debug] 19339#19339: *5 post rewrite phase: 4
2019/09/01 18:17:37 [debug] 19339#19339: *5 generic phase: 5
2019/09/01 18:17:37 [debug] 19339#19339: *5 generic phase: 6
2019/09/01 18:17:37 [debug] 19339#19339: *5 generic phase: 7
2019/09/01 18:17:37 [debug] 19339#19339: *5 access phase: 8
2019/09/01 18:17:37 [debug] 19339#19339: *5 access phase: 9
2019/09/01 18:17:37 [debug] 19339#19339: *5 access phase: 10
2019/09/01 18:17:37 [debug] 19339#19339: *5 post access phase: 11
2019/09/01 18:17:37 [debug] 19339#19339: *5 generic phase: 12
2019/09/01 18:17:37 [debug] 19339#19339: *5 try files handler
2019/09/01 18:17:37 [debug] 19339#19339: *5 http script var: "/flask"
2019/09/01 18:17:37 [debug] 19339#19339: *5 trying to use file: "/flask" "/var/www/html/flask"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http script var: "/flask"
2019/09/01 18:17:37 [debug] 19339#19339: *5 trying to use dir: "/flask" "/var/www/html/flask"
2019/09/01 18:17:37 [debug] 19339#19339: *5 trying to use file: "=404" "/var/www/html=404"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http finalize request: 404, "/flask?" a:1, c:1
2019/09/01 18:17:37 [debug] 19339#19339: *5 http special response: 404, "/flask?"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http set discard body
2019/09/01 18:17:37 [debug] 19339#19339: *5 xslt filter header
2019/09/01 18:17:37 [debug] 19339#19339: *5 HTTP/1.1 404 Not Found
Server: nginx/1.14.0 (Ubuntu)
Date: Sun, 01 Sep 2019 16:17:37 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Content-Encoding: gzip
2019/09/01 18:17:37 [debug] 19339#19339: *5 write new buf t:1 f:0 0000560FB16BC3E0, pos 0000560FB16BC3E0, size: 195 file: 0, size: 0
2019/09/01 18:17:37 [debug] 19339#19339: *5 http write filter: l:0 f:0 s:195
2019/09/01 18:17:37 [debug] 19339#19339: *5 http output filter "/flask?"
2019/09/01 18:17:37 [debug] 19339#19339: *5 http copy filter: "/flask?"
2019/09/01 18:17:37 [debug] 19339#19339: *5 image filter
2019/09/01 18:17:37 [debug] 19339#19339: *5 xslt filter body
2019/09/01 18:17:37 [debug] 19339#19339: *5 http postpone filter "/flask?" 0000560FB16BC520
2019/09/01 18:17:37 [debug] 19339#19339: *5 http gzip filter
2019/09/01 18:17:37 [debug] 19339#19339: *5 malloc: 0000560FB167D280:12288
2019/09/01 18:17:37 [debug] 19339#19339: *5 gzip alloc: n:1 s:5952 a:8192 p:0000560FB167D280
2019/09/01 18:17:37 [debug] 19339#19339: *5 gzip alloc: n:512 s:2 a:1024 p:0000560FB167F280
2019/09/01 18:17:37 [debug] 19339#19339: *5 gzip alloc: n:512 s:2 a:1024 p:0000560FB167F680
2019/09/01 18:17:37 [debug] 19339#19339: *5 gzip alloc: n:512 s:2 a:1024 p:0000560FB167FA80
2019/09/01 18:17:37 [debug] 19339#19339: *5 gzip alloc: n:256 s:4 a:1024 p:0000560FB167FE80
2019/09/01 18:17:37 [debug] 19339#19339: *5 gzip in: 0000560FB16BC550
2019/09/01 18:17:37 [debug] 19339#19339: *5 gzip in_buf:0000560FB1674EE0 ni:0000560FB104F880 ai:116
2019/09/01 18:17:37 [debug] 19339#19339: *5 malloc: 0000560FB16A82A0:4096
2019/09/01 18:17:37 [debug] 19339#19339: *5 deflate in: ni:0000560FB104F880 no:0000560FB16A82A0 ai:116 ao:4096 fl:0 redo:0
2019/09/01 18:17:37 [debug] 19339#19339: *5 deflate out: ni:0000560FB104F8F4 no:0000560FB16A82A0 ai:0 ao:4096 rc:0
2019/09/01 18:17:37 [debug] 19339#19339: *5 gzip in_buf:0000560FB1674EE0 pos:0000560FB104F880
2019/09/01 18:17:37 [debug] 19339#19339: *5 gzip in: 0000560FB16BC560
2019/09/01 18:17:37 [debug] 19339#19339: *5 gzip in_buf:0000560FB1674F30 ni:0000560FB10500A0 ai:62
2019/09/01 18:17:37 [debug] 19339#19339: *5 deflate in: ni:0000560FB10500A0 no:0000560FB16A82A0 ai:62 ao:4096 fl:4 redo:0
|
Er scheint statt auf den Container zugreifen zu wollen, die Daten in /var/www/html/flask zu suchen. Das soll er aber nicht, sondern direkt auf den Port 5000 gehen.
Was mach ich falsch?
VG niesel