我想從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)。 –