Answer the question
In order to leave comments, you need to log in
Why doesn't the webserver pick up a %20 space in a link?
Old nginxa config:
map $request_uri $expires {
default off;
~*\.(css|js|gif|jpe?g|png|woff|svg)$ 168h;
}
map $request_uri $cacheControl {
default no-cache;
~*\.(css|js|gif|jpe?g|png|woff|svg)(\?v=\d+)?$ "public";
}
server {
listen 80;
server_name mysite.com;
rewrite ^(.*) https://www.mysite.com$1 permanent;
}
server {
listen 80;
server_name blog.mysite.com;
rewrite ^(.*) https://www.mysite.com permanent;
}
server {
listen 80;
server_name media.mysite.com;
rewrite ^(.*) https://www.mysite.com permanent;
}
include /etc/nginx/conf.d/nginx-redirects-map.txt;
server {
listen 80;
root /var/www/mysite/mysite/public;
server_name www.mysite.com node1.mysite.com;
proxy_set_header X-Forwarded-Proto $scheme;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
index index.html;
location /search/ {
rewrite ^/search/([^\?].*)$ https://www.mysite.com/search?search_phrase=$1 last;
}
location /deprecated.html {
index deprecated.html last;
}
location / {
if ($deprecated = 1) {
rewrite ^ https://www.mysite.com/deprecated.html redirect;
}
if ($http_x_forwarded_proto = "http") {
rewrite ^/(.*)$ https://www.mysite.com/$1 permanent;
}
if ($new_uri) {
rewrite ^ $new_uri permanent;
}
rewrite ^/(.*)/$ https://www.mysite.com/$1 permanent;
add_header Cache-Control $cacheControl;
include /etc/nginx/mime.types;
try_files $uri @prerender;
}
location /api {
root /var/www/mysite/mysite-api/web;
rewrite ^/api/(.*)$ /$1 break;
try_files $uri /app.php$is_args$args;
}
# PROD
location ~ ^/app\.php(/|$) {
set $request_url $request_uri;
if ($request_uri ~ ^/api/(.*)$ ) {
set $request_url /$1;
}
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 600;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param REQUEST_URI $request_url;
fastcgi_param SCRIPT_FILENAME /var/www/mysite/mysite-api/web$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /var/www/mysite/mysite-api/web;
internal;
}
location /api/panel {
root /var/www/mysite/mysite-api/web;
try_files $uri /api/app.php$is_args$args;
}
error_log /var/log/nginx/mysite_mysite_error.log;
access_log /var/log/nginx/mysite_mysite_access.log;
}
echo '<pre>';
var_dump($_SERVER);
die();
["REQUEST_URI"]=>
string(41) "/search/locations/Hong%2520Kong%3Flimit=5"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question