不知道有人在这个问题上遇到过坎没,反正是困扰我很久了
原因是这样的,外面云平台的 VPS的centos里面没有问题,自己安装的系统呢,更改了www和日志目录后,nginx或者apache都无法启动,会报 日志目录没有读写权限,而测试给了777,也不行,偶然机会,在v2ex询问高人之下,发现如下方法可以解决:
关闭 selinux ( setenforce 0 )(临时解决方案)
/etc/sysconfig/selinux 中修改 第一行生效的部分为“SELINUX=disabled”(永久,生效后重启,阿里云是这种方案)报错内容
3 月 23 11:23:59 localhost.localdomain systemd[1]: Starting nginx - high performance web server... 3 月 23 11:23:59 localhost.localdomain nginx[30550]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 3 月 23 11:23:59 localhost.localdomain nginx[30550]: nginx: [emerg] open() "/home/www/log/error.log" failed (13: Permission denied) 3 月 23 11:23:59 localhost.localdomain nginx[30550]: nginx: configuration file /etc/nginx/nginx.conf test failed 3 月 23 11:23:59 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1 3 月 23 11:23:59 localhost.localdomain systemd[1]: Failed to start nginx - high performance web server. 3 月 23 11:23:59 localhost.localdomain systemd[1]: Unit nginx.service entered failed state. 3 月 23 11:23:59 localhost.localdomain systemd[1]: nginx.service failed.
这里还有
-- Unit nginx.service has begun starting up. 3 月 23 11:40:36 localhost.localdomain nginx[30609]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 3 月 23 11:40:36 localhost.localdomain nginx[30609]: nginx: [emerg] open() "/home/www/log/error.log" failed (13: Permission denied) 3 月 23 11:40:36 localhost.localdomain nginx[30609]: nginx: configuration file /etc/nginx/nginx.conf test failed 3 月 23 11:40:36 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1 3 月 23 11:40:36 localhost.localdomain systemd[1]: Failed to start nginx - high performance web server. -- Subject: Unit nginx.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit nginx.service has failed. -- -- The result is failed. 3 月 23 11:40:36 localhost.localdomain systemd[1]: Unit nginx.service entered failed state. 3 月 23 11:40:36 localhost.localdomain systemd[1]: nginx.service failed. 3 月 23 11:40:36 localhost.localdomain polkitd[3159]: Unregistered Authentication Agent for unix-process:30603:203289 (system bus name :1.32, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale zh_CN.UTF-8) (disconnected from bus)
目前已经测试nginx解决,apache还没测试