English 中文(简体)
Nginx 地点,别名,重塑,根基
原标题:Nginx location, alias, rewrite, root

I m通过代理服务/oo/bar,希望继续这样做。 然而,我要静态地从A/var/www/mystatic/baz.swf等口号中服务。

我希望,我能够做这样的事情。

    location /foo/bar/(.*) {
      alias /var/www/mystatic/;
    }

    location / {
      proxy_pass ....;
      ... 
    }

并且/foo/bar/将进入应用服务器,而/foo/bar/(*)将固定地服务。

docs说,我可以这样做,需要综合使用根基和螺纹:

除了这一复杂因素之外,我还要继续使用古老、未经支持的0.5.33。 任何帮助都会受到高度赞赏。

Edit:前进,有人建议使用根基而不是别物。 但是,我似乎无法用我的版本在地点指令上作任何reg? 这里, proxy/巴尔/巴兹。 我的档案载于/var/www/foo/bar/baz.swf。

    location /foo/bar/(.+) {
      root /var/www/;
    }
问题回答
location = /foo/bar/baz.swf {} 

will clear clear any options set to /foo/bar/baz.swf. So you can leave it where it is as the proxy options will not be used.

你可以:

# mkdir /var/www/foo  
# mv /var/www/mystatic /var/www/foo/bar

接着利用这个会议:

location ~ ^/foo/bar/(.+) {
  root /var/www/;
}




相关问题
URL rewrite in IIS6 - Third party tools

I have collected the following api/sdk/whatever which provide modules for doing url rewriting in IIS 5/6/7. Some are free-open source and some require $. I haven t tried any of them. I would like to ...

Rewrite spring-security redirect URLs

I m trying to get Tuckey UrlRewriteFilter to tidy up URLs for my webapp. One problem I ve got is that when spring-security notices that an anonymous user is trying to access a protected resource it ...

ASP.NET Friendly URLs

In my research, I found 2 ways to do them. Both required modifications to the Application_BeginRequest procedure in the Global.Asax, where you would run your code to do the actual URL mapping (mine ...

Could I get by HttpModule the URL that contains * before?

My web-site is working under ASP.NET 3.5, IIS7, Integrated pipiline mode. My HttpModule is getting request to all resources, including URLs like this: http://my-site.com/address And I would support *...

Domains & Foreward Slash

This is rather difficult to explain so please bear with me. We will be hosting 4 websites on our server and the plan is to have each site sit under its own domain: site-a.com site-b.com sub1.site-b....

URL Mod-Rewrite

I currently have a working URL: http://example.com/security-services.php?service=fixed-camera-surveillance and then I have PHP say, $_REQUEST[ service ] to do some stuff... But I d like to ...

热门标签