Apache服务器:编辑httpd.conf文件(拒绝) [英] Apache Server: Editing httpd.conf file (permission denied)
问题描述
所以,我只是最近下载Apache服务器与它的所有文件(httpd的4月,APR-UTIL,PCRE)以下这里决定的说明:的 http://httpd.apache.org/docs/2.4/install.html
So I just recently downloaded Apache server with all of its files (httpd, apr, apr-util, pcre) following the instructions dictated here: http://httpd.apache.org/docs/2.4/install.html
然而,经过设置,当我试图启动我的Apache服务器,它位于我的USR / local / bin目录/,我被提示此消息:
However, after set-up, when I tried to start my Apache server, which is located in my usr/local/bin/, I was prompted with this message:
[allen@allen-lnx ~]$ /usr/local/bin/apachectl start
(13)Permission denied: AH00091: httpd: could not open error log file /usr/local/logs/error_log.
AH00015: Unable to open logs
经过一番研究,我发现,我需要修改我的httpd.conf文件,我这样做是较早以允许正确的服务器名和监听选项。然而,我不能确定如何编辑我的conf文件,以允许访问日志目录。
After some research, I have found that I need to edit my httpd.conf file, which I did so earlier to allow for the correct ServerName and Listen options. However, I am unsure as to how to edit my conf file to allow for access to the "logs" directory.
值得注意的是,该命令将在运行时我用的是命令命令,但我会preFER不经常使用,由于它看起来像周围的工作。
Notably, the command will run when I use the "sudo" command, but I would prefer to not always use that since it seems like a work around.
任何帮助将AP preciated。谢谢!
Any help would appreciated. Thanks!
编辑:其实我已经注意到,我可能有两个的httpd.conf文件,这被证明是一个小麻烦。另外一个是位于我的根/ etc /目录(ETC / httpd的/ conf目录/ httpd.conf文件)。我想现在我修改的问题是...哪一个我应该保留?是的/ etc /版本是内置的,由下面faff的评论所指示的人?
I've actually noticed that I may have two httpd.conf files, which is proving to be a little troublesome. The other one is located in my root /etc/ directory (etc/httpd/conf/httpd.conf). I think my modified question now is... which one should I be keeping? Is the /etc/ version the one that is built in, as indicated by faff's comment below?
目前的解决方案:我想我会只接受这样的事实,我需要使用sudo编辑这个文件的时候,因为我需要root权限。以后我可能会改变它,这样我总是以root身份运行,但就目前而言,须藤
就足够了。
Current Solution: I figured I would just accept the fact that I need to use sudo when editing this file since I need to be root. I might change it later so that I'm always running as root, but for now, sudo
will suffice.
推荐答案
这看起来像一个问题与他的文件系统权限。确保的/ usr /本地/日志/
目录存在并且是可写的由你正在运行的Apache的用户。
This looks like an issue with he filesystem permissions. Make sure the /usr/local/logs/
directory exists and is writeable by the user you're running Apache as.
如果你不想让你的日志
由普通用户可写目录,也可以创建日志文件:
If you don't want to have your logs
directory writeable by normal user, you can create the log file:
sudo touch /usr/local/logs/error_log
,然后将该文件的所有者更改为正确的用户:
And then change the owner of the file to the correct user:
sudo chown allen /usr/local/logs/error_log
假设你要运行Apache的用户阿伦
。
如果你想改变的Apache日志文件的位置,寻找在你的httpd.conf文件中的错误日志
指令(你必须添加它,如果它不存在)
If you want to change the location of Apache logfile, look for the ErrorLog
directive in your httpd.conf file (you will have to add it if it's not there):
ErrorLog path/to/logfile
这篇关于Apache服务器:编辑httpd.conf文件(拒绝)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!