Apache
权限
授权普通用户管理文档目录
$ sudo groupadd www
$ sudo usermod -a -G www ubuntu
$ sudo chown -R root:www /var/www
$ sudo chomd 2775 /var/www
$ find /var/www -type d -exec sudo chmod 2775 {} +
$ find /var/www -type f -exec sudo chmod 0664 {} +
Apache 对文档目录的写权限
比如 Wordpress 通过控制面板上传图片,需要 Apache 具有对文档目录的写权限。www-data
为 Ubuntu 中 Apache 默认的运行用户名。
$ sudo usermod -a -G www www-data
$ find /var/www/wordpress -type d -exec sudo chmod 2775 {} +
$ find /var/www/wordpress -type f -exec sudo chmod 0664 {} +
$ sudo service apache2 restart
文件布局
RHEL-7 / httpd-2.4
模块的加载与否在 /etc/httpd/conf.modules.d/
目录里控制。没有单独的模块选项配置文件。
主配置文件是 /etc/httpd/conf/httpd.conf
。
虚拟主机及其他配置在 /etc/httpd/conf.d
目录。
还有一个用来设置环境变量的配置文件在 /etc/sysconfig/httpd
(Systemd 使用)。
Gentoo / Apache-2.2
模块的加载与否在主配置文件 /etc/apache2/httpd.conf
里设置,需要结合 /etc/conf.d/apache2
(Systemd 使用) 中定义的 APACHE2_OPTS
环境变量。
模块的选项在 /etc/apache2/modules.d/
目录里的补充配置文件分别配置。
虚拟主机配置文件在 /etc/apache2/vhosts.d
目录。