`
sillycat
  • 浏览: 2551889 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Nginx Proxy and Redirect from Root Path

 
阅读更多
Nginx Proxy and Redirect from Root Path

location = /index {
}
It means exactly match.
location = /index.html {
    resolver {{resolver_server_list}};
    proxy_pass       https://manage.{{short_domain}};
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_ssl_server_name on;
    add_header 'Access-Control-Allow-Origin' $http_origin;
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    add_header 'Access-Control-Allow-Credentials' 'true';
  }
So, this means proxy to the https://manage.xxxxxx URL, the proxy_ssl_server_name on; is very important.
This means redirect 301 to the new domain and URL
location = /index.html {
     return 301 https://manage.{{short_domain}}/index.html;
  }
  location = / {
    return 301 https://manage.{{short_domain}}/;
  }


References:
https://www.tollmanz.com/nginx-location-match-homepage/
分享到:
评论

相关推荐

    nginx静态文件缓存的解决方案1

    proxy_cache_path /usr/local/nginx/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g; # ... } ``` 这里,`proxy_cache_path` 指定了缓存存储的路径,`levels` 参数定义了缓存目录的层级,`...

    Windows下Nginx的安装与配置

    proxy_store用于设置代理存储,proxy_temp_path用于设置代理临时文件路径,proxy_redirect用于设置代理重定向,proxy_set_header用于设置代理头信息。 nginx的安装与配置是非常重要的,需要根据实际情况进行配置,...

    Windows nginx +多个 tomcat 配置

    proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_...

    linux下Nginx+tomcat整合的安装与配置.docx

    root /path/to/your/static/files; index index.html index.htm; } location /app/ { proxy_pass http://localhost:8080/app/; include /usr/local/nginx/conf/proxy.conf; } } ``` 这里,`/app/`是Tomcat...

    nginx-1.0.0服务器软件

    2. **缓存设置**:使用`proxy_cache_path`定义缓存路径,`proxy_cache`指令启用缓存,`proxy_cache_bypass`、`proxy_no_cache`控制缓存策略。 ### 六、URL重写 通过`rewrite`指令实现URL重定向或内部重定向,`...

    Windows_Nginx_Tomcat_负载均衡服务器

    proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_...

    nginx配置

    - `proxy_cache_path`: 定义缓存路径和参数。 - `proxy_cache`: 启用缓存,并指定缓存名称。 - `proxy_cache_bypass` 和 `proxy_no_cache`: 控制是否跳过缓存直接向后端服务器发送请求。 7. **安全设置** - `...

    Nginx+Tomcat+Redis实现负载均衡、资源分离、session共享

    proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ... } } ``` 二、资源分离 资源分离是指将...

    nginx配置访问图片路径以及html静态页面的调取方法

    proxy_redirect off; client_max_body_size 10m; client_body_buffer_size 1280k; proxy_connect_timeout 900; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 ...

    使用Nginx_Supervisor_tornado搭建web服务参考.pdf

    root /usr/share/nginx/html; } } ``` 使配置生效并重启Nginx: ```bash sudo ln -s /etc/nginx/sites-available/your-site.conf /etc/nginx/sites-enabled/ sudo service nginx reload ``` 现在,你已经成功地...

    Linux服务器下Nginx与Apache共存的实现方法分析

    proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ``` 3. 配置Apache:编辑Apache的配置...

    详解Linux下Nginx+Tomcat整合的安装与配置

    proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 10m; client_body_buffer_size 128k; ... ``` 4. 修改主配置文件 `nginx.conf`,配置工作进程...

Global site tag (gtag.js) - Google Analytics