问题描述
我在MacBook上运行OS X试图教我如何编写CGI脚本和我卡上的第一步,改变的httpd.conf
文件。我以下说明:,我尝试使用终端命令须藤的vim的/ etc /的Apache2 / httpd的改变
。然而,当我准备尝试和保存文件时,它说,这是只读的。我正在按照指示说,我应该去掉注释的httpd.conf
文件.conf文件 AddHandler的CGI脚本的CGI
但是,我怎么来,如果我不能做到这一点保存文件?
I'm on a MacBook running OS X trying to teach myself how to write CGI scripts and I'm stuck on the very first step, altering the httpd.conf
file. I'm following these instructions: http://www.cgi101.com/book/connect/mac.html and I'm trying to alter the httpd.conf
file using the terminal command sudo vim /etc/apache2/httpd.conf
. However when I get ready to try and save the file it says that it's read-only. The instructions that I'm following say that I'm supposed to uncomment the line AddHandler cgi-script .cgi
however, how am I supposed to do this if I can't save the file?
我是很新的CGI脚本,Apache和终端一般。
I'm very new to CGI scripts, Apache and terminal in general.
Edit:从命令的输出: ls -l命令/etc/apache2/httpd.conf
是:
The output from the command: ls -l /etc/apache2/httpd.conf
is:
-r--r--r-- 1 root wheel 24330 Jul 11 2011 /etc/apache2/httpd.conf
编辑:当我试图挽救它说补充!重写
。当我这样做使用命令 :! X
退出了,但产生的误差 launch_msg(检入),IPC失败:不允许操作
。
When I try to save it says add ! to override
. When I do so using the command :!x
it exits out but produces the error launch_msg("CheckIn") IPC failure: Operation not permitted
.
推荐答案
要保存的只读文件添加!
Vim命令之后,而不是之前。如果您以后添加它,然后它会尝试运行shell命令(不Vim命令)。在这种情况下,你正在运行名为 X
shell命令,打印你所提到的消息。您需要:X
保存并关闭或::W
来只保存文件
To save read-only file add !
after Vim command, not before. If you add it after, then it will try to run shell command (not Vim command). In this case you are running shell command named x
, that prints message that you mentioned. You need :x!
to save and close or :w!
to just save file.
这篇关于如何更改Apache的httpd.conf文件在Mac OS X?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!