我有一个SaaS webapp服务,所以每次在我的注册应用程序中注册一个新的客户端,它会创build一个新的子域和一个新的apache虚拟主机configuration文件,启用这个configuration我需要重新启动apache(运行在端口8080),如果我试图运行/etc/init.d/apache2 restart或在www-data(这是运行我的应用程序的用户)下的apache2ctl restart ,我得到以下错误:
Address already in use: make_sock: could not bind to address 0.0.0.0:8080 no listening sockets available, shutting down Unable to open logs Action 'start' failed. The Apache error log may have more information.
我怎么能自动重启Apache?
操作系统是Ubuntu服务器10.10
你可以把它添加到sudoers文件中,然后使用sudo来调用apache restart命令。
Cmnd_Alias AP2RESTART=/etc/init.d/apache2 www-data ALL=NOPASSWD: AP2RESTART