如題,已經嘗試好幾個方法還是失敗,所以上來請教,先謝謝回答的人。
在lightsail上放了兩份檔案,一個是flask,一個是fastapi,分別監聽5000和8888端口。
flask負責網頁呈現,fastapi負責api呼叫功能(功能名稱已改過,非實際名稱),如下:
# 分頁上的功能FastAPI
ProxyPass "/api/" "http://127.0.0.1:8888/"
ProxyPassReverse "/api/" "http://127.0.0.1:8888/"
# 分頁
ProxyPass "/dataExtract" "http://127.0.0.1:5000/dataExtract"
ProxyPassReverse "/dbExtract" "http://127.0.0.1:5000/dataExtract"
# 首頁
ProxyPass "/" "http://127.0.0.1:5000/"
ProxyPassReverse "/" "http://127.0.0.1:5000/"
在lightsail上,繞過apache代理呼叫curl -i http://127.0.0.1:8888/download_data 都沒問題,一旦測試apache代理(如curl -i http://127.0.0.1/api/download_data 就會出現404 Not Found. The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.),確定ProxyPass和ProxyPassReverse沒打錯,也試過加上root_path,都不成功。
請問有人遇過這種錯誤嗎?還有哪些方向可以思考嗎?謝謝。
你的 httpd.conf 有 listen port 80 嗎?
Virtualhost 整段資訊可以多附上一點嗎?