Differences between revisions 2 and 3
Revision 2 as of 2019-11-06 10:58:25
Size: 150
Editor: PieterSmit
Comment:
Revision 3 as of 2022-12-21 22:55:02
Size: 812
Editor: PieterSmit
Comment:
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:


== Nginx map ==
 * Map is used as fast efficient lookup in nginx
 * Format is {{{
map $var_to_compare $var_to_set {
  ~String1Regex SetValue1;
  ~String2Regex SetValue2;
  default SetDefaultValue;
}
}}}
 * e.g. seo redirect {{{
map $request_uri $map_seo_redirect {
    default 0;
    ~/path1/subpath?q=abc$ https://vigor.nz/newurl1;
    ~/path2 https://vigor.nz/newurl2
}
...
...
    if ($map_seo_redirect) {
          add_header X-debug-message "map_seo_redirect - testme - $request_uri" always;
          rewrite ^ $map_seo_redirect permanent;
          # return 301 $map_seo_redirect;
      }

}}}

Linux/Nginx notes

Nginx

listen 443 ssl http2;

Nginx proxy

http://www.tweaked.io/guide/nginx-proxying/

Nginx map

  • Map is used as fast efficient lookup in nginx
  • Format is

    map $var_to_compare $var_to_set {
      ~String1Regex   SetValue1;
      ~String2Regex   SetValue2;
      default         SetDefaultValue;
    }
  • e.g. seo redirect

    map $request_uri $map_seo_redirect {
        default 0;
        ~/path1/subpath?q=abc$  https://vigor.nz/newurl1;
        ~/path2                 https://vigor.nz/newurl2
    }
    ...
    ...
        if ($map_seo_redirect) {
              add_header X-debug-message "map_seo_redirect - testme - $request_uri" always;
              rewrite ^ $map_seo_redirect permanent;
              # return 301 $map_seo_redirect;
          }


CategoryLinux

Linux/Nginx (last edited 2022-12-21 22:55:02 by PieterSmit)