Nginx 如何在加载ressource文件(css/image)的代理传递后重写url
我有一个服务器,在以下url上有3个Web应用程序:Nginx 如何在加载ressource文件(css/image)的代理传递后重写url,nginx,Nginx,我有一个服务器,在以下url上有3个Web应用程序: 詹金斯() 雄猫() 声纳() 我想重写所有这些url,使其看起来像这样: 所以我编辑了我的nginx.conf: worker_processes 1; events { worker_connections 1024; } http { default_type application/octet-stream; sendfile on; keepalive_timeo
- 詹金斯()
- 雄猫()
- 声纳()
worker_processes 1;
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location /sonar/ {
proxy_pass http://localhost:9000/;
}
location /tomcat/ {
proxy_pass http://localhost:8080/;
}
location /jenkins/ {
proxy_pass http://localhost:7000/;
}
}
}
因为这些文件位于localhost/appName/css或image上,调用的url是localhost/css或image。有人能告诉我如何重写所有的url吗 尝试使用
$host
而不是localhost
。还有,目前的状况如何?任何错误、日志输出等…?$host on server_name未更改任何内容,也未更改任何日志:/查看nginx文档和ServerFault上的标签,了解如何提升日志。您还可以始终返回200$request\u文件名代码>。这篇关于Nginx的博客可能也会有所帮助。