有線URL重寫問題CGT文件和Nginx的URL重寫
而我轉到
它工作正常,回購協議顯示出來。但是該網頁上的鏈接附加/富再次 即
當我轉到URL像
它的工作原理,但對各個環節該頁看起來像
這裏是我的nginx.conf,我錯過了什麼?
server {
listen 80;
server_name git.example.org;
root /var/www/htdocs/cgit;
index cgit.cgi;
location ~* ^.+\.(css|png|ico)$ {
expires 30d;
}
if ($request_filename = cgit.cgi){
rewrite ^/([^/]+/.*)$ /cgit.cgi?url=$1 last;
}
location/{
try_files $uri @cgit;
}
location @cgit {
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi;
fastcgi_param HTTP_HOST $server_name;
fastcgi_param PATH_INFO $uri;
include fastcgi_params;
}
access_log /var/log/nginx/cgit_access.log;
error_log /var/log/nginx/cgit_error.log warn;
}
更新,解決了
這是虛擬的root =/ 的CGT文件設置和我更新了我的nginx.conf過,現在的URL改寫的作品!
server {
listen 80;
server_name git.mengzhuo.org;
root /var/www/htdocs/cgit;
location ~* ^.+\.(css|png|ico)$ {
expires 30d;
}
location/{
index cgit.cgi;
fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param HTTP_HOST $server_name;
fastcgi_param PATH_INFO $uri;
fastcgi_param QUERY_INFO $uri;
include "fastcgi_params";
}
access_log /var/log/nginx/cgit_access.log;
error_log /var/log/nginx/cgit_error.log warn;
}
我已經通過在cgit中設置virtual-root = /解決了這個問題,現在一切正常。 – 2013-04-26 02:01:51
然後隨時接受答案。 – Danack 2013-04-26 16:23:45