There is the following code in the website html:
<link rel="stylesheet" href="/static/css/bootstrap.min.css" />
<link rel="stylesheet" href="/static/css/bootstrap-theme.min.css" />
<link rel="stylesheet" href="/static/css/jquery.treegrid.css" />
<link rel="stylesheet" href="/static/css/browseraudit.css" />
The problem now is that the browser cannot read these files
Use go as the server and nginx as the reverse proxy
The html files are placed in the /home/user/project/ directory
static and other folders Also placed in this directory
/home/user/project/ is the project root directory
nginx has made the following configuration
location /static/ {
alias /home/user/project/static/;
}
But it doesn’t feel like it’s working
How can I make the browser correctly find the specified file without modifying the original code of the web page?
Let me give you an nginx configuration file of beego for your reference. The general principle is that in addition to specifying the css, js, fonts, and img characters in the URL, nginx takes over. If the file does not exist, it will be forwarded to the backend request, which is equivalent to the web opened by GO. Server