【问题标题】:nginx location directivenginx 位置指令
【发布时间】:2012-11-09 22:16:59
【问题描述】:

我有一个带有 rails 应用程序的 nginx 服务器。 我的 nginx.conf 是

server {
      listen 80;
      server_name nerto.it;
      root /var/www/current/public; 
      passenger_enabled on;


    location /m {
        passenger_enabled off;
        index index.html index.php;
        try_files $uri $uri/ /m/index.html?q=$uri;
    }
...
}

它的工作原理除了地址 nerto.it/mprove 或 nerto.it/mtry

其中首字母是/m,而nginx取这个地址,比如nerto.it/m

我该如何解决?

【问题讨论】:

    标签: ruby-on-rails nginx location passenger


    【解决方案1】:
    location /m/ {
        passenger_enabled off;
        index index.html index.php;
        try_files $uri $uri/ /m/index.html?q=$uri;
    }
    

    location = /m {
        ...
    }
    

    从您的问题中不清楚您期望什么行为。

    请阅读文档:http://nginx.org/r/location

    【讨论】:

      【解决方案2】:

      我认为你应该这样尝试:

      location ~* ^/m(.*) {
      

      通过在它们前面加上“~*”前缀(用于不区分大小写的匹配)或“~”前缀(用于区分大小写的匹配)来指定正则表达式。

      nginx location directive

      【讨论】:

        猜你喜欢
        • 2012-04-22
        • 1970-01-01
        • 2020-03-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-02-15
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多