首先修改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. Windows 环境下Java调用CRF++详解

    1.步骤一览 2.步骤详情 2.1.环境准备 Swig(Simplified Wrapper and Interface Generator)下载,Windows操作系统直接解压即可使用 CRF++( ...

  2. 页面中CSS的四种引入方式的介绍与比较

    转自:https://blog.csdn.net/qq_38689666/article/details/79039392 一:行内式 <p style="color:red" ...

  3. Closest Common Ancestors

    Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u, ...

  4. 24-从零玩转JavaWeb-包装类、自动装箱、自动拆箱

    一.什么是包装类 二.对基本数据类型包装的好处 三.装箱操作 四.拆箱操作 五.自动装箱 六.自动拆箱 七.字符串与基本数据类型和包装类的转换   八.包装类的缓存设计

  5. 因采用 Flask 原生 WSGI 出现 "Broken pipe" 报错的故障处理

    :first-child { margin-top: 0; } blockquote > :last-child { margin-bottom: 0; } img { border: 0; m ...

  6. codeforce469DIV2——E. Data Center Maintenance

    题意: 有n个数据中心,m个客户,每天有h个小时,其中 n,m,h<=100000.每个数据中心i每天都会有一个数据维护的时间0<=u[i]<=h-1,在数据中心维护期间时不可以使用 ...

  7. SaeMysql操作示例

    新浪sae的官方说明文档:http://apidoc.sinaapp.com/sae/SaeMysql.html Class SaeMysql 具体实现:http://apidoc.sinaapp.c ...

  8. Ubuntu16 install Anaconda

    gbt@gbt-Precision-7720:~$ gbt@gbt-Precision-7720:~$ cd Anacondagbt@gbt-Precision-7720:~/Anaconda$ gb ...

  9. 633. Sum of Square Numbers 是否由两个完全平方数构成

    [抄题]: Given a non-negative integer c, your task is to decide whether there're two integers a and b s ...

  10. 内存cache使用的场景

    Q.业务场景内为什么要使用内存cache? A.为了利用内存cache的优点, 解决业务场景内的缺陷 Q.内存cache的优点和缺点 A.优点: 内存读写速度比磁盘块 缺点: 内存空间有限, 内存单价 ...