NGINX redirection issue

manish-ezest nginx-forum at nginx.us
Thu Aug 7 16:02:43 UTC 2014


Hello Maxim,

Thank you for your response. Here is the my nginx settings

**************my NGINX.conf********************
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
worker_rlimit_nofile 30000;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format combined_time '$remote_addr - $remote_user [$time_local]'
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time';

access_log /var/log/nginx/access.log combined_time;
include /etc/nginx/servers/*.conf;
}
**********************************************

******************************VHOST SETTING*****
server {
listen 80;
server_name www-aaa.com;
add_header Cache-Control off;
expires 1d;
root /var/empty;
error_log /var/log/nginx/www.aaa.com-error.log;
access_log /var/log/nginx/www.aaa.com-access.log combined_time;
location = /favicon.ico {
root /www;
}
proxy_intercept_errors on;
error_page 400 401 402 403 404 406 407 408 409 410 411 412 413 414 415 416
417 495 496 497 500 501 502 503 504 505 506 507 = /error_page.pl;
error_page 405 =200 $uri;
location /error_page.pl {
fastcgi_pass 127.0.0.1:8999;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_pass_header "Status";
}

location / {
## Rewrite root to index of bbb folder.
rewrite ^/$ http://www.aaa.com/aaaa/bbb/index.html permanent;
## Rewrite all directory lookups to 'index.html'
rewrite ^(.*)/$ $1/index.html permanent;
## Rewrite all open strings to index.html
rewrite ^(.*)/([^\.\?/]+)$  $1/$2/index.html permanent;
proxy_redirect off;
proxy_set_header Host www.aaa.com.s3.amazonaws.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Referer www.aaa.com;
proxy_pass http://www.aaa.com.s3.amazonaws.com/;
}
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,252379,252391#msg-252391



More information about the nginx mailing list