@@ -34,35 +34,26 @@ data:
34
34
server 127.0.0.1:9000;
35
35
}
36
36
37
- # Redirect IP requests to the domain
38
37
server {
39
- listen 80;
40
- server_name _;
38
+ listen 80 default_server ;
39
+ server_name cloud-screenshot.dc-screenshot.svc.cluster.local _;
41
40
42
- # Redirect all requests to the domain
43
- location / {
44
- return 301 http://cloud-screenshot.dc-screenshot.svc.cluster.local$request_uri;
45
- }
41
+ root /srv/cloud-screenshot/web;
42
+ index index.html index.htm index.php;
46
43
47
- # Handle liveness probe
48
- location /healthz {
49
- access_log off;
50
- return 200 ;
44
+ # Handle requests to both domain and IP
45
+ set $host_to_use $host;
46
+ if ($host ~* "^\d+\.\d+\.\d+\.\d+$") {
47
+ set $host_to_use cloud-screenshot.dc-screenshot.svc.cluster.local ;
51
48
}
52
- }
53
49
54
- server {
55
- listen 80;
56
- server_name cloud-screenshot.dc-screenshot.svc.cluster.local;
57
-
58
- root /srv/cloud-screenshot/web;
59
- index index.html index.htm index.php;
50
+ location / {
51
+ proxy_set_header Host $host_to_use;
52
+ try_files $uri $uri/ /index.php?$args;
53
+ }
60
54
61
55
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {
62
- ## this redirects sitemap.xml to /sitemap_index.xml
63
56
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
64
-
65
- ## this makes the XML sitemaps work
66
57
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last;
67
58
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
68
59
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
74
65
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
75
66
}
76
67
77
- location / {
78
- try_files $uri $uri/ /index.php?$args;
79
- }
80
-
81
68
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
82
69
access_log off; log_not_found off; expires 1d;
83
70
}
87
74
try_files $uri =404;
88
75
fastcgi_split_path_info ^(.+\.php)(/.+)$;
89
76
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
77
+
78
+ # Always use the domain in the Host header for PHP processing
79
+ fastcgi_param HTTP_HOST $host_to_use;
80
+
90
81
include fastcgi_params;
91
82
fastcgi_read_timeout 60;
92
83
fastcgi_pass php;
0 commit comments