Nginx 特定于url的重定向的ngnix配置设置
我想将特定URL重定向到运行在不同端口上的本地服务器,但不确定需要在nginx.config中添加什么。谢谢Nginx 特定于url的重定向的ngnix配置设置,nginx,Nginx,我想将特定URL重定向到运行在不同端口上的本地服务器,但不确定需要在nginx.config中添加什么。谢谢 e.g: for url /v1/jobs I want to direct it to a local server running on port 9090 以下是我当前的nginx配置设置: http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodela
e.g: for url /v1/jobs
I want to direct it to a local server running on port 9090
以下是我当前的nginx配置设置:
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
使用
URI保持不变-如有必要,您可以在代理传递之前使用重写来更改URI
重新启动nginx
nginx-s是否重新加载
或者将HUP发送到进程killall-HUP nginx
或重新启动服务nginx restart
或/etc/init.d/nginx重新启动
location ^~ /v1/jobs {
proxy_pass http://www.domain.com:9090
}