Chinaunix首页 | 论坛 | 博客
  • 博客访问: 536979
  • 博文数量: 59
  • 博客积分: 1169
  • 博客等级: 少尉
  • 技术积分: 572
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-01 18:03
个人简介

信息量太大,每天疲于辨别信息得真伪。

文章分类

全部博文(59)

文章存档

2016年(1)

2014年(9)

2013年(1)

2011年(48)

分类: LINUX

2011-05-05 17:23:27

- apache2: bad user name ${APACHE_RUN_USER}

 

网上找的解决方法是

一、

==============================================================================

Ubuntu - Apache2 - apache2: bad user name ${APACHE_RUN_USER}

在Ubuntu下sudo apt-get install apache2安装完Apache2以后,启动apache2的默认用户名是www-data, 属于www-data用户组

在shell中按如下输入

#apache2

会出现错误提示:

apache2: bad user name ${APACHE_RUN_USER}

解决办法:

1. 打开apache2的配置文件

#sudo gedit /etc/apache2/apache2.conf

(本来应该改envvars这个文件的,但是不知道为什么修改了不起作用)

2. 修改默认的用户名和组

找到 ${APACHE_RUN_USER} 和 ${APACHE_RUN_GROUP}

替换为自己的用户名和组,然后保存退出。

3.重启apache2

#apache2 -k graceful

注意,要让自己的用户对/var/www这个目录有写权限,否则你的脚本可能会出问题的。

当然,可以打开/etc/apache2/sites-enabled/000-default修改网站文件的根目录。

http://congfeng02.javaeye.com/blog/435313

==============================================================================

二、

==============================================================================

I believe this is because etc/init.d is not in your command path. Unlike Windows, Linux does not look in the "current" directory for commands. So, if you are in /etc/init.d you can type "sudo ./apache2 restart" which will tell it to look in the current directory with the "./" The script in /etc/init.d/apache2 explicitly reads in the environment variables before calling /usr/sbin/apache2. /usr/sbin/ is in yoour command path, so that is the one that runs when you just type "apache2 ..."

 

他的意思是命令行的目录问题,具体是

 

  -$ cd /etc/init.d/

  -$ sudo apache2 -k restart  会出现错误 ,这种情况下环境变量还没有读取

 

 -$ sudo /etc/init.d/apache2 -k restart

或者

-$ cd /etc/init.d/

-$ sudo ./apache2 -k restart 这两种命令都不会出现该错误

 

==============================================================================

 

但是我都没成功,只好放弃重启apache2了。

阅读(3260) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~