Конфиг сервера:
server {
listen 80;
server_name $servername;
access_log /home/$servername/log/nginx_access.log;
error_log /home/$servername/log/nginx_error.log;
location ~* \.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|xml|docx|xlsx)$ {
root /home/$servername/www/;
index index.php;
access_log off;
expires 30d;
location / {
proxy_pass http://127.0.0.1:81/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
proxy_set_header Host $host;
proxy_connect_timeout 60;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_redirect off;
proxy_set_header Connection close;
proxy_cache_valid 200 301 302 304 5m;
proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
proxy_hide_header "Set-Cookie";
proxy_pass_header Content-Type;
proxy_pass_header Content-Disposition;
proxy_pass_header Content-Length;
proxy_ignore_headers "Cache-Control" "Expires";
}
location ~ /\.ht {
deny all;
}
}
<?php
header("Location: $location" );
php>
При открытии в браузере этой страницы происходит редирект на страницу servername:81/location