Skip to content

Commit b58f294

Browse files
committed
feat(cloud-screenshot): update nginx config
1 parent ea51425 commit b58f294

File tree

2 files changed

+17
-26
lines changed

2 files changed

+17
-26
lines changed

charts/cloud-screenshot/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ maintainers:
55
66
name: Elegant Themes
77
name: cloud-screenshot
8-
version: 1.0.8
8+
version: 1.1.0

charts/cloud-screenshot/templates/nginx-config.yml

+16-25
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,26 @@ data:
3434
server 127.0.0.1:9000;
3535
}
3636
37-
# Redirect IP requests to the domain
3837
server {
39-
listen 80;
40-
server_name _;
38+
listen 80 default_server;
39+
server_name cloud-screenshot.dc-screenshot.svc.cluster.local _;
4140
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;
4643
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;
5148
}
52-
}
5349
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+
}
6054
6155
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {
62-
## this redirects sitemap.xml to /sitemap_index.xml
6356
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
64-
65-
## this makes the XML sitemaps work
6657
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last;
6758
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
6859
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
@@ -74,10 +65,6 @@ data:
7465
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
7566
}
7667
77-
location / {
78-
try_files $uri $uri/ /index.php?$args;
79-
}
80-
8168
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)$ {
8269
access_log off; log_not_found off; expires 1d;
8370
}
@@ -87,6 +74,10 @@ data:
8774
try_files $uri =404;
8875
fastcgi_split_path_info ^(.+\.php)(/.+)$;
8976
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+
9081
include fastcgi_params;
9182
fastcgi_read_timeout 60;
9283
fastcgi_pass php;

0 commit comments

Comments
 (0)