Ubuntu Lucid、cgi-bin 和 MathTex
所以我有几台运行 Ubuntu Lucid 服务器的专用服务器。他们主要运行 WordPress 网站 - LAMP。然而,我原来的网站之一是一个控制工程网站,它使用 MathTex 来渲染方程。
MathTex 对服务器来说相当困难。工程站点仍然托管在原始 VPS 上,该 VPS 运行类似 CentOS 的系统(但这无关紧要)。 MathTex 创建的流量和渲染数量导致我的 VPS 出现资源问题。我已经能够为 VPS 分配更多资源,但最终会变得昂贵。因此,我想将方程渲染卸载到我的专用服务器上,所有这些服务器都更强大且利用率较低。
所以我按照安装和编译 MathTex 的说明进行操作。 MathTex 在命令行下工作得很好。但是,当我尝试通过浏览器调用脚本时,浏览器都会尝试下载 cgi 文件(我已经在 2 台计算机上的 Firefox 和 Chrome 上进行了测试)。
这导致我尝试在我的家庭 Ubuntu 盒子(即 Ubuntu 桌面)上进行编译和安装。命令行工作正常。然而,当我在浏览器中调用该函数时,它再次想要下载文件而不是渲染方程。所以我将 mathtex.cgi 脚本移至 /usr/lib/cgi-bin
。还是不行。然后我将 /usr/lib/cgi-bin 更改为 777 并且它起作用了。我将 /usr/lib/cgi-bin
更改为 755,它停止工作。
所以当 /usr/lib/cgi-bin
为 777 时,我的家庭盒子可以工作。我尝试了我的专用 Ubuntu 服务器之一,但仍然不行。我的浏览器仍然尝试下载该文件。
Apache 查找 cgi-bin 目录的指令位于 /etc/apache/site-available/default 中。乍一看它们似乎是相同的(我还没有研究每个角色)。
So I have several dedicated servers out there running Ubuntu Lucid server. They primarily run WordPress sites - LAMP. However, one of my original sites is a controls engineering site that uses MathTex to render the equations.
MathTex is pretty hard on servers. The engineering site is still hosted on the original VPS which runs something like CentOS (but that's irrelevant). The traffic and numbers of renderings that MathTex creates cause resource issues with my VPS. I've been able to allocate more resources to the VPS but ultimately this gets expensive. So I'd like to offload the equation rendering to my dedicated servers all of which are much more powerful and under-utilized.
So I've followed the instructions on installing and compiling MathTex. And MathTex works fine from the command line. However, when I attempt to call the script via my browser the browsers all try download the cgi file (I've tested on Firefox and Chrome on 2 machines).
This led me to attempt to compile and install on my home Ubuntu box that is Ubuntu desktop. The command line works fine. However, again when calling the function in my browser it wanted to download the file instead of rendering an equation. So I moved the mathtex.cgi script to /usr/lib/cgi-bin
. Still no go. Then I changed /usr/lib/cgi-bin
to 777 and it worked. I changed /usr/lib/cgi-bin
to 755 and it stopped working.
So my home box works when /usr/lib/cgi-bin
is 777. I tried that one of my dedicated Ubuntu servers and still no go. My browser still attempts to download the file.
The directive for Apache to find the cgi-bin directory is in /etc/apache/site-available/default
. And at a quick glance they appear to be identical (I haven't yet studied every character).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅供参考,
我从我的托管公司得到了一些帮助。它们通常都很好,但这超出了他们免费提供的范围。因此,当我切换服务器时,我遇到了一些密码问题,并设法解决了这个问题。
支持人员最终通过在域文件夹下创建 /cgi-bin 来运行 mathtex.cgi 脚本。创建该文件夹 777 并将 AddHandler cgi 脚本添加到 http.conf。然后他重新启动了Apache2。
我一直将 mathtex.cgi 放在通用 /cgi-bin 目录下,我打算根据需要在所有域之间共享该目录。这个通用 /cgi-bin 目录似乎是 MathTex 安装说明所建议的。
希望这对其他人有帮助。
FYI
I got some help from my hosting company. They are generally pretty good but this is outside the scope of what they provide for free. So when I was switching servers I had a couple of password issues and managed to tack this question on as well.
The support person finally got the mathtex.cgi script to run by creating a /cgi-bin under the domain's folder. Making that folder 777 and adding an AddHandler cgi-script to the http.conf. Then he restarted Apache2.
I had been putting mathtex.cgi under a generic /cgi-bin directory that I had intended to share among all the domains as needed. And this generic /cgi-bin directory appeared to be what the MathTex installation instructions were suggesting.
Hope this helps someone else.