ubuntn 安装apache

来源:互联网 发布:苹果经常无法加入网络 编辑:程序博客网 时间:2024/04/26 01:57
能上网的话sudo apt-get install apache2不能上网先去官方下载apache2.0 : httpd-2.0.63.tar.gz 1.解压缩httpd-2.0.63.tar.gz到临时目录如~/httpd-2.0.63 2.进入~/httpd-2.0.63目录,执行 #./configure --prefix=/usr/local/apache2 --enable-module=so #make #make install 实际执行过程中可能要求你有root权限,所以要求使用sudo. 如果需要mod_rewrite模块,需要加参数: --enable-rewrite 3.启动和停止apache 启动:sudo /usr/local/apache2/bin/httpd -k start 启动时提示:   httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName. 解决办法是在http.conf中加一行:   ServerName 127.0.0.1:80 停止:sudo /usr/local/apache2/bin/httpd -k stop 4.让Ubuntu开机自动启动apache. 1). 复制 /usr/local/apache2/bin/apachectl到/etc/init.d 2). 加载为服务      sudo update-rc.d apachectl defaults 开机重启访问http://localhost/如果显示apache的网页,就说明自动启动成功了。

在ubuntu下启动apache和mysql的命令

  1. // Apache  
  2. //Task: Start Apache 2 Server /启动apache服务  
  3. # /etc/init.d/apache2 start  
  4. //or  
  5. $ sudo /etc/init.d/apache2 start  
  6. //Task: Restart Apache 2 Server /重启apache服务  
  7. # /etc/init.d/apache2 restart  
  8. //or  
  9. $ sudo /etc/init.d/apache2 restart  
  10. //Task: Stop Apache 2 Server /停止apache服务  
  11. # /etc/init.d/apache2 stop  
  12. //or  
  13. $ sudo /etc/init.d/apache2 stop   
  14. // Mysql  
  15. /etc/init.d/mysql start  
  16. /etc/init.d/mysql stop  
  17. /etc/init.d/mysql restart 

原创粉丝点击