首先修改httpd.conf配置文件。

vim conf/httpd.conf

添加:

Listen 1234

然后把

  1.  
    # Virtual hosts
  2.  
    #Include conf/extra/httpd-vhosts.conf

改成

  1.  
    # Virtual hosts
  2.  
    Include conf/extra/httpd-vhosts.conf

就是使用虚拟配置,然后去编辑conf/extra/httpd-vhosts.conf,添加:

  1.  
    24 <VirtualHost *:1234>
  2.  
    25 DocumentRoot "/xxx/xxx/xxx"
  3.  
    26 ServerName localhost
  4.  
    33 <Directory "/xxx/xxx/xxx">
  5.  
    35 Require all granted
  6.  
    36 </Directory>
  7.  
    37 </VirtualHost>

然后重启apache:

apachectl restart

然后在浏览器访问就可以了,
这里要补充一句, 网上很多资料说conf/extra/httpd-vhosts.conf添加:

  1.  
    33 <Directory "/xxx/xxx/xxx">
  2.  
    35 Order allow,deny
  3.  
    36 Allow from all
  4.  
    37 </Directory>

这是2.2版本修改配置的方法,2.4版本换套路了,如果这么配置,log日志会报错:

client denied by server configuration: /xxx/xxx/xxx, referer: http://xxx/xxx/xxx

所以,对于2.4版本的apache,正确的配置方法是:

 
  1.  
    33 <Directory "/xxx/xxx/xxx">
  2.  
    35 Require all granted
  3.  
    36 </Directory>

apache2.4配置的更多相关文章

  1. ubuntu 启用apache2 虚拟机配置

    Ubuntu 启用apache2 虚拟机配置 http://jingyan.baidu.com/article/5d6edee20b78e999eadeecf7.html

  2. ubuntu14.04安装 Apache2 并配置https

    一.安装 Apache2 sudo apt-get update sudo apt-get install apache2 安装完apache2,默认根目录在/var/www/html 下,点击其下的 ...

  3. 转 PHP5+APACHE2.2配置

    初学php,配置起来老出问题,找了篇不错的帖子,一试就通过了,所以就顺带着转了过来. 不过在我安装phpMyAdmin的时候还是发现这篇文章的一个问题,就是php.ini如果放在system32下,启 ...

  4. apache2.4配置多个端口对应多个目录

    文件 /usr/local/apache/conf/extra/httpd-vhosts.conf 的内容如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 NameVir ...

  5. Ubuntu下的apache2的配置过程

    参考apache2的中文文档:http://httpd.apache.org/docs/2.4/ 安装apache2: apt-get install apache2 安装apache2doc文档:a ...

  6. Ubuntu下apache2安装配置(内含数字证书配置)

    Ubuntu下apache2安装配置(内含数字证书配置)安装命令:sudo apt-get updatesudo apt-get install apache2 配置1.查看apache2安装目录命令 ...

  7. ubuntu 安装apache2并配置cgi,搭建mimetex转化公式图片的服务

    一.Apache的安装 在终端输入: sudo apt-get install apache2 二.启动.停止Apache服务 Apache的启动和停止文件是:/etc/init.d/apache2 ...

  8. ubuntu下apache2 安装 配置 卸载 CGI设置 SSL设置

    一.安装.卸载apache2      apache2可直接用命令安装           sudo apt-get install apache2      卸载比较麻烦,必须卸干净,否则会影响ap ...

  9. apache2.4配置虚拟目录

    刚开始学习,跟着韩顺平老师的视频课件学习ing~ 这是自己在配置虚拟目录时遇到的问题以及解决办法,记录下来~ ---------------------------分割线君-------------- ...

  10. ubuntu apache2 ssl配置

    Ubuntu下HTTPS配置非常简单,对大部分用户而言,使用普通的自签名证书,只需按照步骤进行就可以了,无需了解密钥.证书的更多知识,更深的背景 知识还有RSA算法.DES算法.X509规范.CA机构 ...

随机推荐

  1. left join的多重串联与groupby

    有三张表或组合查询,f1,f2,f3,其中,f1分别与f2,f3是一对多关系,f1一条记录可能对应f2或f3中0条或多条记录 要创建一个查询,以f1为基准,即f1中有多少条记录,结果也就返回对应数量的 ...

  2. 执行CRUD总结

  3. localtime 的性能问题及其替代者

    在系统从redhat5升到redhat6的过程中,服务的性能差了很多.经过定位发现是程序中频繁调用localtime/localtime_r所致. 而调用localtime_r 的实现中,对时区进行了 ...

  4. Redhat 下添加用户到docker用户组

    1. 检查系统中是否存在docker用户组,如果没有则手动添加 # sudo cat /etc/group |grep docker # sudo grouped -g 999 docker # -g ...

  5. 游戏引擎架构Note2

    [游戏引擎架构Note2] 1.视觉属性(visual property)决定光线如何与物体表面产生交互作用. 2.一个Mesh所使用三角形的多少可以用细致程度(level-of-detail,LOD ...

  6. JS中的两种刷新方法以及区别和适用范围

    在项目中有一个人信息修改的页面,但是修改后显示的却是修改之前的内容,分析问题后发现查询语句写在了修改语句之前,有些某些需要又必须这么写,但是修改信息后先却显示之前的信息也太不科学了. 所以我就想用js ...

  7. linux环境配置与使用合集

    配置linux和samba共享 1. 安装linux操作系统 2. 通过windows操作系统ping linux看看是否可以ping通 3. 相关软件安装 a. 安装samba sudo apt-g ...

  8. Browser

    浏览器中关于事件的那点事儿 作者: 顽Shi  发布时间: 2014-02-01 20:22  阅读: 7830 次  推荐: 25   原文链接   [收藏]   摘要:事件在Web前端领域有很重要 ...

  9. You-need-to-know-css

    半透明边框 背景知识: background-clip <div class="main"> <input id="pb" type=&quo ...

  10. Python字符编码详解,str,bytes

    什么是明文 “明文”是可以是文本,音乐,可以编码成mp3文件.明文可以是图像的,可以编码为gif.png或jpg文件.明文是电影的,可以编码成wmv文件.不一而足. 什么是编码?把明文变成计算机语言 ...