日期:2014-05-16  浏览次数:20689 次

新手求助安装apache for linux
我是一个新手,刚开始玩linux。装了一个centos6.2
又下了一个apache的最新版本。
问题 :
1:是否应该先卸载系统默认安装的apache。
2:我没卸载,直接安装的最新版apache,也能成功访问默认的http://127.0.0.1/站点了。但如何重启服务。
我用[root@localhost bin]# apachectl restart 提示
httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
httpd not running, trying to start
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
3:我想建2个站,分别是80,81端口
在httpd.conf文件中修改如下 :

Listen 80
Listen 81
在末尾添加
#---------------------------------
# 虚拟主机端口
NameVirtualhost localhost:81 
  <virtualhost localhost:81>
#这里就是你的网站目录绝对路径了哦~注意斜杠的方向
  documentroot /usr/local/apache2/htdocs2 
#对应监听的端口
  servername locahost:81 
  </virtualhost>

<Directory "/usr/local/apache2/htdocs2">
  Options Indexes FollowSymLinks
#允许URL重写
  AllowOverride All 
  Order allow,deny
  Allow from all
  </Directory>
路径什么的是对的,但站点不能正确显示。应如何修改。
4:操作系统的默认apache安装的位置是哪。



------解决方案--------------------
http://linux.chinaunix.net/techdoc/database/2009/05/14/1112559.shtml
------解决方案--------------------
系统默认的apache是用rpm安装的,若你自己是用源码安装的,不卸载也可以的,我就在redhat5上自己动手源码安装了apache,系统自带的没有卸载,用起来没问题的,自己安装apache重新启动是/usr/local/apache/bin/apachectl stop/start系统自带的apache应该是安装在etc/httpd这个文件夹里面的,你可以查看看,或者搜索httpd,应该可以找到,因为系统自带apache的名称是httpd;