nginx位置指令

时间:2012-11-21 15:56:57

标签: ruby-on-rails nginx location passenger

我有一个带有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

我该如何解决?

2 个答案:

答案 0 :(得分: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

答案 1 :(得分:-1)

我认为你应该像这样尝试smth:

location ~* ^/m(.*) {
  

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

nginx location directive

相关问题