2010-06-08 38 views
0

我已經給了一個lighttpd.conf,其他人寫了,並且需要幫助來制定如何提供服務。我是那裏的90%,但卡住了... index.html頁面出現,但鏈接和CSS文件沒有指向正確的位置。瞭解lighttpd.conf文件?

爲了澄清,鏈接和CSS文件都指向'file:///'URL。所以styles.css在HTML標頭指向file:///html/styles.css,而它應該去http://example.com/styles.css

也許url.rewrite或url.redirect工作不正常?

server.document-root = "~/html" 
server.port = 28001 
mimetype.assign = (
    ".html" => "text/html", 
    ".txt" => "text/plain", 
    ".jpg" => "image/jpeg", 
    ".png" => "image/png" 
) 
url.rewrite = (
    "^(.*)/($|\?.*)" => "$1/index.html", 
    "^(.*)/([^.?]+)($|\?.*)$" => "$1/$2.html" 
) 
$HTTP["scheme"] == "http" { 
    url.redirect = ( 
        "^/platform/index.html$" => "/platform", 
        "^/about/company.html$" => "/about/company",, 
) 
} 

----- UPDATE ------

file:///的問題,現在解決了,感謝馬塞爾。但是,http://example.com/about/company仍然找不到任何內容,而http://example.com/about/company.html呈現正常。 url.rewrite有問題嗎?我正在使用lighttpd的v1.4.20,所以也許我需要將它改爲重寫一次或重寫最終?

+0

聽起來像是您所服務的HTML頁面存在問題,包含'file://',而不是您的Web服務器的配置選項。你有一個示例頁面嗎? – 2010-06-08 11:42:04

+0

你是對的!現在解決了這個問題 - 謝謝。 (如果你想添加這個作爲答案,我會接受它,所以你得到的積分)重定向仍然無法正常工作,雖然... – AP257 2010-06-08 11:56:11

+0

你更新中的這兩個網址並不真正指向你但是,這僅僅是一個例子嗎?然後使用example.com,所以每個人都可以看到它是一個例子(並且不會混淆使用url.com的人)。 – 2010-06-08 12:29:32

回答

1

關於原始問題:它不是web服務器配置的問題,而是所服務的HTML的問題,可能包含file://協議。改爲使用http://

關於第二個問題:我不是在lighttpd的配置選項方面的專家,但如果你在url.redirect交換這些設置,擺脫尾隨逗號,像它可能幫助:

url.redirect = ( 
        "^/platform$" => "/platform/index.html", 
        "^/about/company$" => "/about/company.html" 
) 

(但我不確定)。例子見the documentation

順便說一句,是mod_redirect加載於server.modules

+0

是的 - 你說的都對 - 加入'server.modules =(「mod_redirect」)'解決了這個問題。謝謝! – AP257 2010-06-08 15:04:29