在普通用户下运行apache2

hi,
 
   我们这里没办法装solaris-64的服务器. 没这个环境. 但我在Linux下配置成功. :)
 
修改了httpd.conf, 以下是涉及的地方.
 
PidFile /home/aaronliu/run/httpd.pid
Listen x.x.x.x:18888
User aaronliu
Group aaronliu
 
CustomLog /home/aaronliu/logs/access_log common
CustomLog /home/aaronliu/logs/referer_log referer
CustomLog /home/aaronliu/logs/agent_log agent
CustomLog /home/aaronliu/logs/access_log combined
 
使用此配置, 我可以使用aaronliu这个账号启动apache, 使用ps -fe | grep httpd查看情况如下:
 
aaronliu  2439     1  0 13:03 ?        00:00:00 httpd -k start
aaronliu  2441  2439  0 13:03 ?        00:00:00 httpd -k start
aaronliu  2442  2439  0 13:03 ?        00:00:00 httpd -k start
aaronliu  2443  2439  0 13:03 ?        00:00:00 httpd -k start
aaronliu  2444  2439  0 13:03 ?        00:00:00 httpd -k start
aaronliu  2445  2439  0 13:03 ?        00:00:00 httpd -k start
aaronliu  2446  2439  0 13:03 ?        00:00:00 httpd -k start
aaronliu  2447  2439  0 13:03 ?        00:00:00 httpd -k start
aaronliu  2448  2439  0 13:03 ?        00:00:00 httpd -k start
 
并且可以正常访问.
 
需要注意的两点:
1/ 因为普通用户没办法切换账号, 所以启动httpd的用户, 必须和User Group中是一致的(第三, 四行).
2/ pidfile文件, log文件都必须定向到 启动用户具有权限的地方.
3/ 普通用户没办法监听80端口, 所以要换成其它端口. 请注意防火墙的映射情况.
 
请网络部的同事试试. 因我没在solaris情况下试验, 所以最好是找台测试机试验一下.
 
如有问题, 请及时联系

猜你喜欢

转载自happyforever82.iteye.com/blog/539071