我想从apache迁移我的个人sterver到nginx,但我不能得到的位置工作。Nginx的工作与类似Apache的位置
我的服务器有几个应用程序,在某些/某事从根部,像url.com/git url.com/mediaWiki avaliable,url.com/vnstat url.com/redmine
在Apache中一个有一堆为每个应用程序配置文件:
redmine.conf
<Location "/redmine">
Options none
Require all granted
PassengerEnabled On
RailsBaseURI /redmine
RailsEnv production
</Location>
vnstat_php.conf
Alias /vnstat /var/www/vnstat_php
<Directory /var/www/vnstat_php>
DirectoryIndex index.php
Require all granted
</Directory>
我正试图在nginx上复制这个,但我迄今为止最好的尝试最终得到了一个奇怪的url。我只有管理事主ngix配置文件的工作文字:
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;
}
}
根页好的工作,但/ 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"
它正在寻找一个vnstat/var/www/vnstat_php /目录中,而不是以root身份使用它。任何人都可以将我指向正确的方向吗?
你需要'alias'不' root'。或许[像这样](http://stackoverflow.com/questions/42176020/nginx-yii2-configuration-in-different-folders/42203734#42203734)。 –