我目前正在使用URL路径的JS项目上工作。现在,如果我使用example.com/进入我的网站,则JavaScript将无法工作,因为我实际上需要example.com/index.html。
我已经在使用反向代理来代理传递给两个不同的Docker容器。所以我的想法是将请求传递给example.com/index.html时example.com/被调用。但是我不知道要实现这个目标的正则表达式的东西。
我的旧配置:
server {
listen 80;
server_name example.com;
# allow large uploads of files - refer to nginx documentation
client_max_body_size 1G;
# optimize downloading files larger than 1G - refer to nginx doc
before adjusting
#proxy_max_temp_file_size 2G;
location / {
proxy_pass http://structure.example:80;
}
location /cdn {
proxy_pass http://content.example:80;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试过的东西:
server {
listen 80;
server_name example.com;
# …Run Code Online (Sandbox Code Playgroud)