在 Ubuntu 20.04 中配置的 Apache2 服务器

Apache2 server configured in Ubuntu 20.04

我在 ubuntu 中配置 Apache 服务器,其中 DicrectoryRoot 是 /srv/proxy,但是当我在浏览器中调用该网页时,它下载了该页面。基本上目录有 /srv/proxy/proxy.pac,我想在浏览器中看到 proxy.pac 文件而不是下载。

index.html 文件在浏览器中正确显示,但如果我输入 proxy.pac 而不是 index.html 文件,则文件已下载。我希望浏览器显示 proxy.pac.

的内容

任何想法

浏览器下载文件基于两个 headers:

  1. Content-Type
  2. Content-Disposiiton.

您可以使用以下命令查看 header:

curl -s -D - "http://your.domain.com" |头-n 20

为了防止浏览器下载文件,我们需要在 default000.conf 中设置 Content-Type text/plain .filetypes (.pac, .doc) 以在浏览器中显示内容.