problem description
RT wants to set up two different front-end projects to access different static resources, but does not know how to set them, for example,
wechat accesses css and js files under the wechat path
manager accesses css and js files under the manager path
the environmental background of the problems and what methods you have tried
several regular and direct directory access are used in the
Nginx configuration, but none of them are valid. If you use wildcards, you cannot return the specified js
.related codes
/ / Please paste the code text below (do not replace the code with pictures)
what result do you expect? What is the error message actually seen?
server {
listen 80;
server_name 127.0.0.1;
root /opt/;
location / {
try_files $uri @gunicorn_proxy;
}
location @gunicorn_proxy {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://localhost:5000;
}
location /wechat/ {
index index.html;
try_files $uri $uri/ /index.html;
}
location /manager/ {
index index.html
try_files $uri $uri/ /index.html;
}
location ~*.(jpg|jpeg|gif|png|ico|css|js|pdf|txt)$ {
root /opt/manager/;
}
location /wechat/(jpg|jpeg|gif|png|ico|css|js|pdf|txt)$ {
root /opt/wechat/;
}
}