line 45: return: [[: numeric argument required
location /projects/test/v2.2.2/socket.io/
location /projects/test/v2.2.2
location /projects/test/v2.2.2/socket.io/
location /projects/test/v2.2.2
line 45: return: [[: numeric argument required
NOT FOUND
checkLocationExists () {
pathWithShieldingSlash=$(echo "$1" | sed 's/\//\\\//g')
isPathExists=$(sed -n 's/.*\(location '"$pathWithShieldingSlash"'.*\).*{/\1/p' "$locations_path/$file_name")
echo "$isPathExists"
if [[ -z $isPathExists ]]; then
return 0
else
return 1
fi
}
test=$(checkLocationExists "$path")
if checkLocationExists "$path"; then
echo "FOUND"
else
echo "NOT FOUND"
fi
location /projects/test/v2.2.2/socket.io/
location /projects/test/v2.2.2
location /projects/test/v2.2.2/socket.io/
location /projects/test/v2.2.2
NOT FOUND
rewrite ^/blog(.*) /$1 break;
location / { ... }
не подойдёт.server {
server_name sub.domain.com;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/sub.domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/sub.domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
include /etc/nginx/locations/sub.domain.com.*.locations;
}
#location /static/ {
# modsecurity on;
# proxy_pass http://10.1.0.6:3000;
#}
location /projects/test/2.0.0 {
modsecurity on;
proxy_pass http://10.1.0.6:3000/;
}
server_name sub.domain.com;
listen 443;
... ssl settings ...
include *.locations
http://10.1.0.6:3000/
докер контейнер, в котором тоже nginx, но это не должно влиять, т.к. запросы направляются на внешний интерфейс контейнера. location="
location /projects/$1/$2 {
proxy_pass http://10.1.0.6:$3;
}"
line=`grep -n '^ *location' myfile | sed -rn '1s/(.+):.+/\1/p'` # номер первой строки с location
sed -ri "$line s/.+/$location\n&/" myfile
line=`grep -n '^ *location' myfile | sed -rn '1s/(.+):.+/\1/p'` # номер первой строки с location
sed -ri "$line s/.+/0000\n&/" myfile