Tente isto:
se a diretiva proxy_pass for especificada com um URI:
location / {
proxy_pass http://127.0.0.1:8080/mapped_dir/;
proxy_set_header Host $host;
}
então
test.org/xxxxx will proxy to http://127.0.0.1:8080/mapped_dir/xxxxx
conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/test.org/access.log main;
server {
listen 80;
# handle requests containing anything.test.org in the HTTP header hosts field
server_name *.test.org;
location / {
proxy_pass http://127.0.0.1:8080/mapped_dir/;
proxy_set_header Host $host;
}
location /images/ {
root /var/www/test.org/images;
add_header "Expires:" "21 days" always;
}
# turn off logging for requests to /somelogo.ico
location /somelogo.ico {
access_log off;
}
}