How to change Apache httpd.conf file on Mac OS X?

心已入冬 提交于 2020-01-13 04:31:09

问题


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?

I'm very new to CGI scripts, Apache and terminal in general.

EDIT: 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

EDIT: 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.


回答1:


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.



来源:https://stackoverflow.com/questions/11333267/how-to-change-apache-httpd-conf-file-on-mac-os-x

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!