Nginx使用类似apache的位置

Nginx使用类似apache的位置,nginx,nginx-location,Nginx,Nginx Location,我正在尝试将我的个人sterver从apache迁移到nginx,但我无法找到工作的位置 我的服务器有几个应用程序,可以从根目录中的某些/某些内容获得,比如url.com/git url.com/mediaWiki、url.com/vnstat url.com/redmine 在apache a中,每个应用程序都有一组配置文件: redmine.conf <Location "/redmine"> Options none Require all granted

我正在尝试将我的个人sterver从apache迁移到nginx,但我无法找到工作的位置

我的服务器有几个应用程序,可以从根目录中的某些/某些内容获得,比如url.com/git url.com/mediaWiki、url.com/vnstat url.com/redmine

在apache a中,每个应用程序都有一组配置文件:

redmine.conf

<Location "/redmine">
    Options none
    Require all granted

    PassengerEnabled On
    RailsBaseURI /redmine
    RailsEnv production
</Location>
根页面工作正常,但是/vnstat链接将我发送到

2017/02/20 11:37:19 [error] 27538#0: *1 "/var/www/vnstat_php/vnstat/index.php" is not found (2: No such file or directory), client: 177.92.59.216, server: _, request: "GET /vnstat/ HTTP/1.1", host: "url.com:8123"
它在/var/www/vnstat_php/中寻找一个vnstat目录,而不是将其用作根目录。有人能给我指出正确的方向吗?

如中所述

文件的路径仅通过向root指令的值添加URI来构造。如果必须修改URI,则应使用alias指令

在这种情况下,您应该使用别名:


但使用PHNP与NGIX应该考虑使用FASCGI:

你需要<代码>别名<代码> > <代码>根>代码>。可能有问题。仍然在错误的位置查找open()“/var/www/html/vnstat”失败(2:没有这样的文件或目录),客户端:177.92.59.216,服务器:389;,请求:“GET/vnstat HTTP/1.1”,主机:“url.com:8123”,参考者:“
server {
    listen       8123 default_server;
    listen       [::]:8123 default_server;
    server_name  _;
    root         /var/www/html;

    location / {
    }

    location /vnstat/ {
        root   /var/www/vnstat_php/;
        index  index.php;
    }
}
2017/02/20 11:37:19 [error] 27538#0: *1 "/var/www/vnstat_php/vnstat/index.php" is not found (2: No such file or directory), client: 177.92.59.216, server: _, request: "GET /vnstat/ HTTP/1.1", host: "url.com:8123"
location /vnstat/ {
  alias /var/www/vnstat_php/;
}