🔨 Change nginx configuration for v3 upgrade (#289)

This commit is contained in:
Malachi Soord 2023-03-14 08:31:21 +01:00 committed by GitHub
parent 10c92da8e2
commit 8d7e1d2937
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 34 deletions

View file

@ -33,33 +33,27 @@ http {
add_header X-XSS-Protection "1; mode=block"; add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none; add_header X-Robots-Tag none;
location /data/firmwares {
add_header Access-Control-Allow-Origin *;
}
location /data/ { location /data/ {
deny all; deny all;
} }
location ~ .php$ { location ~ ^/index\.php(/|$) {
fastcgi_pass 127.0.0.1:9001; fastcgi_pass 127.0.0.1:9001;
fastcgi_read_timeout 900; fastcgi_read_timeout 900;
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
} }
location ~ ^(.*)\.(css|js|gif||jpe?g|png|json|cache\.json)$ { location ~ ^(.*)\.(css|js|gif||jpe?g|png|json|cache\.json)$ {
} }
location / {
rewrite ^/login$ /login.php last;
rewrite ^/logout$ /login.php?logout=logout last;
rewrite ^/doAjaxAll$ /index.php?doAjaxAll=doAjaxAll last;
rewrite ^/doAjax$ /index.php?doAjax=doAjax last;
rewrite "/([a-z]{2})/" /index.php?lang=$1 last;
rewrite ^/([a-zA-Z_]+)/([a-zA-Z_]+)/([0-9_]+)/?$ /index.php?page=$1&action=$2&device_id=$3;
rewrite ^/([a-zA-Z_]+)/(force)/?$ /index.php?page=$1&force=1;
rewrite ^/([a-zA-Z_]+)/([a-zA-Z_]+)/?$ /index.php?page=$1&action=$2;
rewrite ^/([a-zA-Z_]+)/([0-9]+)/?$ /index.php?page=$1&device_id=$2;
rewrite ^/([a-zA-Z_]+)/?$ /index.php?page=$1;
}
} }
} }

View file

@ -19,35 +19,26 @@ http {
index index.php; index index.php;
location /data/firmwares { location /data/firmwares {
add_header Access-Control-Allow-Origin *;
} }
location /data/ { location /data/ {
deny all; deny all;
} }
location ~ .php$ { location ~ ^/index\.php(/|$) {
fastcgi_pass 127.0.0.1:9001; fastcgi_pass 127.0.0.1:9001;
fastcgi_read_timeout 900; fastcgi_read_timeout 900;
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
} }
location ~ ^(.*)\.(css|js|gif||jpe?g|png|json|cache\.json)$ { location ~ ^(.*)\.(css|js|gif||jpe?g|png|json|cache\.json)$ {
} }
location / {
rewrite ^/login$ /login.php last;
rewrite ^/logout$ /login.php?logout=logout last;
rewrite ^/doAjaxAll$ /index.php?doAjaxAll=doAjaxAll last;
rewrite ^/doAjax$ /index.php?doAjax=doAjax last;
rewrite "/([a-z]{2})/" /index.php?lang=$1 last;
rewrite ^/([a-zA-Z_]+)/([a-zA-Z_]+)/([0-9_]+)/?$ /index.php?page=$1&action=$2&device_id=$3;
rewrite ^/([a-zA-Z_]+)/(force)/?$ /index.php?page=$1&force=1;
rewrite ^/([a-zA-Z_]+)/([a-zA-Z_]+)/?$ /index.php?page=$1&action=$2;
rewrite ^/([a-zA-Z_]+)/([0-9]+)/?$ /index.php?page=$1&device_id=$2;
rewrite ^/([a-zA-Z_]+)/?$ /index.php?page=$1;
}
} }
} }