Apache 更改默认用户

Apache Change Default User

我希望在名为 app_user 的用户下 运行 apache。为此,我更改了 httpd.conf 文件

中的以下内容
User app_user
Group app_user

app_user 是此服务器上的有效用户和组。

app_user 具有在 /var/log/httpd 目录中写入的正确权限。

现在当我启动 apache 时它给我这个错误。

[app_user@localhost conf]$ service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]

感谢对此的一些帮助。

只有 'root' 用户可以将连接绑定到小于 1024 的端口。有关详细信息,here. Either configure the apache to use different port number which is higher than 1024 or sudo 作为 root 用户。不推荐后期选项。

Root 应该启动 apache 主进程来绑定较低的端口,但是,如果你想为子进程使用不同的 user/group,你可以通过 APACHE_RUN_USERAPACHE_RUN_GROUP 环境变量。 检查 /etc/apache2/apache2.conf:

 User ${APACHE_RUN_USER}
 Group ${APACHE_RUN_GROUP}