首先修改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. BurpSuite—-Spider模块(蜘蛛爬行)

    一.简介 Burp Spider 是一个映射 web 应用程序的工具.它使用多种智能技术对一个应用程序的内容和功能进行全面的清查. Burp Spider 通过跟踪 HTML 和 JavaScript ...

  2. vue 构建前端项目并关联github

    这几天尝试用node开发一个网站,后端的接口已经初步开发完成,现在开始构建前端的项目,记录下过程,在学习下吧. 用vue-cli 构建项目,myproject.(构架过程略过) 每次在本地构建项目后和 ...

  3. uboot启动完成,kernel启动时lcd屏…

    先说说开发环境吧: 1 内核:linux2.6.xx 2 uboot:买开发板带的 注释:在最后我又添加了问题得到完美解决的办法. 问题:uboot启动完成,kernel启动时lcd屏幕出现杂色(比如 ...

  4. Logos

    [Logos] Logos is a component of the Theos development suite that allows method hooking code to be wr ...

  5. ParksLink修改密码

    设置环境变量: ?set classpath=D:\ptc\PartsLink\srclib\jmxcore\WtLogR.jar;D:\ptc\PartsLink\srclib\log4j.jar; ...

  6. 分布式缓存产品Redis和memcached比较区别(图)

  7. LoadRunner 事物

    添加事物 Action() { lr_start_transaction("openindex"); web_url("WebTours", "URL ...

  8. C++中内存区域的划分

    栈存储区 那些由编译器在需要的时候分配,在不需要的时候自动清楚的变量的存储区.里面的变量通常是局部变量.函数参数等. 堆存储区(自由存储区) 那些由new或者malloc分配的内存块,他们的释放编译器 ...

  9. Setting up an OpenGL development environment in ubuntu

    1.opening terminal window and entering the apt-get command for the packages: sudo apt-get install me ...

  10. c++ list 容器

    List vector在STL中是一个双向链表,它的内部结构和vector 或 deque截然不同.主要有以下几点: 1.List不支持随机存取.list没有提供下标操作符和at()的访问. 2.任何 ...