2014-10-11 239 views
1

我想在我的服務器上與NGINX一起使用貝加爾。貝加爾index.php文件是/貝加爾/ HTML重寫NGINX URL位置?

進行以下配置請求可與此網址:

https://www.mydomain.com:8001/baikal/html 

我怎樣才能改變NGINX配置中

https://www.mydomain.com:8001/baikal 

得到重定向到https://www.mydomain.com:8001/baikal/html

這裏是我的NGINX配置:

所有的
server { 
     listen 8001; 

     ssl on; # <-------------------------------------------- SSL 
     ssl_certificate /etc/nginx/ssl/seahub.crt; # <--------- SSL 
     ssl_certificate_key /etc/nginx/ssl/seahub.key; # <----- SSL 

     server_name confile.no-ip.biz; #.tld; # <----------------- CHANGE THIS 

     root /usr/share/nginx/www; 
     index index.html index.htm index.php; 

     rewrite ^/.well-known/caldav /cal.php redirect; 
     rewrite ^/.well-known/carddav /card.php redirect; 

     location/{ 


     location ~ ^(.+\.php)(.*) { 
       try_files $fastcgi_script_name =404; 
       fastcgi_split_path_info ^(.+\.php)(.*)$; 

       fastcgi_pass unix:/var/run/php5-fpm.sock; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
       fastcgi_param PATH_INFO  $fastcgi_path_info; 
       fastcgi_index index.php; 
       include fastcgi_params; 
     } 

     charset utf-8; 

     location ~ /(\.ht|Core|Specific) { 
       deny all; 
       return 404; 
     } 

     } 

} 

回答

1

首先,你不應該有location另一location內。確保他們都是獨立的。

接下來,實際創建重寫:

location = /baikal { 
    return 301 /baikal/html 
} 

應該做的伎倆。