| 1 | user www-data;
|
|---|
| 2 | worker_processes auto;
|
|---|
| 3 | pid /run/nginx.pid;
|
|---|
| 4 | include /etc/nginx/modules-enabled/*.conf;
|
|---|
| 5 |
|
|---|
| 6 | events {
|
|---|
| 7 | worker_connections 768;
|
|---|
| 8 | # multi_accept on;
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 | http {
|
|---|
| 14 |
|
|---|
| 15 | client_header_buffer_size 64k;
|
|---|
| 16 | client_body_buffer_size 64k;
|
|---|
| 17 | large_client_header_buffers 8 512k;
|
|---|
| 18 | client_max_body_size 100m;
|
|---|
| 19 |
|
|---|
| 20 | log_format custom 'site="$server_name" server="$host" dest_port="$server_port" dest_ip="$server_addr" '
|
|---|
| 21 | 'src="$remote_addr" src_ip="$realip_remote_addr" user="$remote_user" '
|
|---|
| 22 | 'time_local="$time_local" protocol="$server_protocol" status="$status" '
|
|---|
| 23 | 'bytes_out="$body_bytes_sent" bytes_in="$upstream_response_length" '
|
|---|
| 24 | 'http_referer="$http_referer" http_user_agent="$http_user_agent" '
|
|---|
| 25 | 'nginx_version="$nginx_version" http_x_forwarded_for="$http_x_forwarded_for" '
|
|---|
| 26 | 'http_x_header="$http_x_header" uri_query="$query_string" uri_path="$uri" '
|
|---|
| 27 | 'http_method="$request_method" response_time="$upstream_response_time" '
|
|---|
| 28 | 'cookie="$http_cookie" request_time="$request_time" ';
|
|---|
| 29 |
|
|---|
| 30 | ##
|
|---|
| 31 | # Basic Settings
|
|---|
| 32 | ##
|
|---|
| 33 |
|
|---|
| 34 | sendfile on;
|
|---|
| 35 | tcp_nopush on;
|
|---|
| 36 | tcp_nodelay on;
|
|---|
| 37 | keepalive_timeout 65;
|
|---|
| 38 | types_hash_max_size 2048;
|
|---|
| 39 | # server_tokens off;
|
|---|
| 40 |
|
|---|
| 41 | # server_names_hash_bucket_size 64;
|
|---|
| 42 | # server_name_in_redirect off;
|
|---|
| 43 |
|
|---|
| 44 | include /etc/nginx/mime.types;
|
|---|
| 45 | default_type application/octet-stream;
|
|---|
| 46 |
|
|---|
| 47 | ##
|
|---|
| 48 | # SSL Settings
|
|---|
| 49 | ##
|
|---|
| 50 |
|
|---|
| 51 | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
|---|
| 52 | ssl_prefer_server_ciphers on;
|
|---|
| 53 |
|
|---|
| 54 | ##
|
|---|
| 55 | # Logging Settings
|
|---|
| 56 | ##
|
|---|
| 57 |
|
|---|
| 58 | #access_log /var/log/nginx/access.log custom;
|
|---|
| 59 | access_log off;
|
|---|
| 60 | error_log /var/log/nginx/error.log;
|
|---|
| 61 |
|
|---|
| 62 | ##
|
|---|
| 63 | # Gzip Settings
|
|---|
| 64 | ##
|
|---|
| 65 |
|
|---|
| 66 | gzip on;
|
|---|
| 67 |
|
|---|
| 68 | # gzip_vary on;
|
|---|
| 69 | # gzip_proxied any;
|
|---|
| 70 | # gzip_comp_level 6;
|
|---|
| 71 | # gzip_buffers 16 8k;
|
|---|
| 72 | # gzip_http_version 1.1;
|
|---|
| 73 | # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|---|
| 74 |
|
|---|
| 75 | ##
|
|---|
| 76 | # Virtual Host Configs
|
|---|
| 77 | ##
|
|---|
| 78 |
|
|---|
| 79 | include /etc/nginx/conf.d/*.conf;
|
|---|
| 80 | include /etc/nginx/sites-enabled/*;
|
|---|
| 81 | map_hash_max_size 262144;
|
|---|
| 82 | map_hash_bucket_size 262144;
|
|---|
| 83 |
|
|---|
| 84 | #nolocale
|
|---|
| 85 | map $http_host$request_uri $dest_nolocale_301 {
|
|---|
| 86 | hostnames;
|
|---|
| 87 | include /etc/nginx/sites-available/nolocale-301.map;
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | map $http_host$uri $dest_nolocale_no_qs_301 {
|
|---|
| 91 | hostnames;
|
|---|
| 92 | include /etc/nginx/sites-available/nolocale-no-qs-301.map;
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | map $http_host$request_uri $dest_nolocale_302 {
|
|---|
| 96 | hostnames;
|
|---|
| 97 | include /etc/nginx/sites-available/nolocale-302.map;
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | map $http_host$uri $dest_nolocale_no_qs_302 {
|
|---|
| 101 | hostnames;
|
|---|
| 102 | include /etc/nginx/sites-available/nolocale-no-qs-302.map;
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 | #en-us
|
|---|
| 106 | map $http_host$request_uri $dest_en_us_301 {
|
|---|
| 107 | hostnames;
|
|---|
| 108 | include /etc/nginx/sites-available/en-us-301.map;
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | map $http_host$uri $dest_en_us_no_qs_301 {
|
|---|
| 112 | hostnames;
|
|---|
| 113 | include /etc/nginx/sites-available/en-us-no-qs-301.map;
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | map $http_host$request_uri $dest_en_us_302 {
|
|---|
| 117 | hostnames;
|
|---|
| 118 | include /etc/nginx/sites-available/en-us-302.map;
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 | map $http_host$uri $dest_en_us_no_qs_302 {
|
|---|
| 122 | hostnames;
|
|---|
| 123 | include /etc/nginx/sites-available/en-us-no-qs-302.map;
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | #en-ca
|
|---|
| 127 | map $http_host$request_uri $dest_en_ca_301 {
|
|---|
| 128 | hostnames;
|
|---|
| 129 | include /etc/nginx/sites-available/en-ca-301.map;
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 | map $http_host$uri $dest_en_ca_no_qs_301 {
|
|---|
| 133 | hostnames;
|
|---|
| 134 | include /etc/nginx/sites-available/en-ca-no-qs-301.map;
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | map $http_host$request_uri $dest_en_ca_302 {
|
|---|
| 138 | hostnames;
|
|---|
| 139 | include /etc/nginx/sites-available/en-ca-302.map;
|
|---|
| 140 | }
|
|---|
| 141 |
|
|---|
| 142 | map $http_host$uri $dest_en_ca_no_qs_302 {
|
|---|
| 143 | hostnames;
|
|---|
| 144 | include /etc/nginx/sites-available/en-ca-no-qs-302.map;
|
|---|
| 145 | }
|
|---|
| 146 |
|
|---|
| 147 | #fr-ca
|
|---|
| 148 | map $http_host$request_uri $dest_fr_ca_301 {
|
|---|
| 149 | hostnames;
|
|---|
| 150 | include /etc/nginx/sites-available/fr-ca-301.map;
|
|---|
| 151 | }
|
|---|
| 152 |
|
|---|
| 153 | map $http_host$uri $dest_fr_ca_no_qs_301 {
|
|---|
| 154 | hostnames;
|
|---|
| 155 | include /etc/nginx/sites-available/fr-ca-no-qs-301.map;
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | map $http_host$request_uri $dest_fr_ca_302 {
|
|---|
| 159 | hostnames;
|
|---|
| 160 | include /etc/nginx/sites-available/fr-ca-302.map;
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 | map $http_host$uri $dest_fr_ca_no_qs_302 {
|
|---|
| 164 | hostnames;
|
|---|
| 165 | include /etc/nginx/sites-available/fr-ca-no-qs-302.map;
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | server {
|
|---|
| 169 | listen 80;
|
|---|
| 170 | server_name www2.indianmotorcycle.com;
|
|---|
| 171 | #access_log /var/log/nginx/access.log custom;
|
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 | location ~* ^/en-us/ {
|
|---|
| 175 | #access_log /var/log/nginx/access.log custom;
|
|---|
| 176 | if ($dest_en_us_301)
|
|---|
| 177 | {
|
|---|
| 178 | return 301 https://$dest_en_us_301;
|
|---|
| 179 | }
|
|---|
| 180 | if ($dest_en_us_no_qs_301)
|
|---|
| 181 | {
|
|---|
| 182 | return 301 https://$dest_en_us_no_qs_301;
|
|---|
| 183 | }
|
|---|
| 184 | if ($dest_en_us_302)
|
|---|
| 185 | {
|
|---|
| 186 | return 302 https://$dest_en_us_302;
|
|---|
| 187 | }
|
|---|
| 188 | if ($dest_en_us_no_qs_302)
|
|---|
| 189 | {
|
|---|
| 190 | return 302 https://$dest_en_us_no_qs_302;
|
|---|
| 191 | }
|
|---|
| 192 | return 301 https://www.indianmotorcycle.com/en-us/;
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | location ~* ^/en-ca/ {
|
|---|
| 196 | #access_log /var/log/nginx/access.log custom;
|
|---|
| 197 | if ($dest_en_ca_301)
|
|---|
| 198 | {
|
|---|
| 199 | return 301 https://$dest_en_ca_301;
|
|---|
| 200 | }
|
|---|
| 201 | if ($dest_en_ca_no_qs_301)
|
|---|
| 202 | {
|
|---|
| 203 | return 301 https://$dest_en_ca_no_qs_301;
|
|---|
| 204 | }
|
|---|
| 205 | if ($dest_en_ca_302)
|
|---|
| 206 | {
|
|---|
| 207 | return 302 https://$dest_en_ca_302;
|
|---|
| 208 | }
|
|---|
| 209 | if ($dest_en_ca_no_qs_302)
|
|---|
| 210 | {
|
|---|
| 211 | return 302 https://$dest_en_ca_no_qs_302;
|
|---|
| 212 | }
|
|---|
| 213 | return 301 https://www.indianmotorcycle.com/en-us/;
|
|---|
| 214 | }
|
|---|
| 215 |
|
|---|
| 216 | location ~* ^/fr-ca/ {
|
|---|
| 217 | #access_log /var/log/nginx/access.log custom;
|
|---|
| 218 | if ($dest_fr_ca_301)
|
|---|
| 219 | {
|
|---|
| 220 | return 301 https://$dest_fr_ca_301;
|
|---|
| 221 | }
|
|---|
| 222 | if ($dest_fr_ca_no_qs_301)
|
|---|
| 223 | {
|
|---|
| 224 | return 301 https://$dest_fr_ca_no_qs_301;
|
|---|
| 225 | }
|
|---|
| 226 | if ($dest_fr_ca_302)
|
|---|
| 227 | {
|
|---|
| 228 | return 302 https://$dest_fr_ca_302;
|
|---|
| 229 | }
|
|---|
| 230 | if ($dest_fr_ca_no_qs_302)
|
|---|
| 231 | {
|
|---|
| 232 | return 302 https://$dest_fr_ca_no_qs_302;
|
|---|
| 233 | }
|
|---|
| 234 | return 301 https://www.indianmotorcycle.com/en-us/;
|
|---|
| 235 | }
|
|---|
| 236 |
|
|---|
| 237 | location / {
|
|---|
| 238 | #access_log /var/log/nginx/access.log custom;
|
|---|
| 239 | if ($dest_nolocale_301)
|
|---|
| 240 | {
|
|---|
| 241 | return 301 https://$dest_nolocale_301;
|
|---|
| 242 | }
|
|---|
| 243 | if ($dest_nolocale_no_qs_301)
|
|---|
| 244 | {
|
|---|
| 245 | return 301 https://$dest_nolocale_no_qs_301;
|
|---|
| 246 | }
|
|---|
| 247 | if ($dest_nolocale_302)
|
|---|
| 248 | {
|
|---|
| 249 | return 302 https://$dest_nolocale_302;
|
|---|
| 250 | }
|
|---|
| 251 | if ($dest_nolocale_no_qs_302)
|
|---|
| 252 | {
|
|---|
| 253 | return 302 https://$dest_nolocale_no_qs_302;
|
|---|
| 254 | }
|
|---|
| 255 | return 301 https://www.indianmotorcycle.com/en-us/;
|
|---|
| 256 | }
|
|---|
| 257 | }
|
|---|
| 258 | }
|
|---|
| 259 |
|
|---|
| 260 |
|
|---|