2012-10-31 82 views
1

我目前使用此設置(使用不同的根路徑)爲我的nginx機器上的另一個網站,對於該網站,這與乾淨的URL正常工作。nginx wordpress乾淨的網址只在一些子站點工作

location ^~ /learn { 
     root /var/www/blogs/mysite/learn; 
     index index.php index.html index.htm; 
     try_files $uri $uri/ /index.php; 

     location ~ \.php$ { 
      fastcgi_split_path_info ^(.*\.php)(.*)$; 
      include fastcgi_params; 
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
      fastcgi_param PATH_INFO $fastcgi_path_info; 
      fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 
      fastcgi_pass 127.0.0.1:9000; 
     } 
} 

但是,當應用於同一臺機器上的不同站點時,乾淨的URL導致頁面未找到錯誤。爲什麼是這樣?

回答

0

try_files行,我在index.php之前加/learn,並解決了這個問題。

try_files $uri $uri/ /learn/index.php;