用过DirectAdmin的都知道,CLI是个坑爹货:网站目录非rwxrwxrwx(777)权限无法写入,无法查看是哪个用户占用较多的资源,甚至无法正常使用opcode cache的PHP组件。 我们来研究下DirectAdmin的站点的配置文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# Auto generated apache config file by DirectAdmin version 1.42.1 # Modifying this file is not recommended as any changes you make will be # overwritten when the user makes any changes to his/her website # For global config changes that affect all Users, see this guide: # http://help.directadmin.com/item.php?id=2 # For local config changes that only affect one User, see this guide: # http://help.directadmin.com/item.php?id=3 # Frontpage requires these parameters in every httpd.conf file or else # it won't work. ServerRoot /etc/httpd <VirtualHost HIDE:80 > ServerName www.360buy.com ServerAlias www.360buy.com 360buy.com ServerAdmin webmaster@360buy.com DocumentRoot /home/admin/domains/360buy.com/public_html ScriptAlias /cgi-bin/ /home/admin/domains/360buy.com/public_html/cgi-bin/ UseCanonicalName OFF <IfModule !mod_ruid2.c> SuexecUserGroup admin admin </IfModule> <IfModule mod_ruid2.c> RMode config RUidGid admin admin RGroups apache access </IfModule> CustomLog /var/log/httpd/domains/360buy.com.bytes bytes CustomLog /var/log/httpd/domains/360buy.com.log combined ErrorLog /var/log/httpd/domains/360buy.com.error.log <Directory /home/admin/domains/360buy.com/public_html> Options +Includes -Indexes php_admin_flag safe_mode OFF php_admin_flag engine ON php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f admin@360buy.com' </Directory> </VirtualHost> |
关键,就在SuexecUserGroup这里,这里定义了站点的执行PHP脚本时所使用的用户身份,这样可以给不同网站的目录不同的所有者,且无需再特意给某些文件设置rwxrwxrwx(777)权限。 然而,这个东西在CGI模式下工作正常,而CLI却不正常。貌似mod_ruid2.c是Su […]