引言:

Apache默认的网站目录是在/var/www/html,我们现在要把网站目录更改到/home/wwwroot/web1/htdocs,操作如下

准备工作:

创建目录:

cd /home
mkdir wwwroot
cd wwwroot
mkdir web1
cd web1
mkdir htdocs
touch index.php

操作步骤:

1、vi /etc/httpd/conf/httpd.conf

找到 DocumentRoot  "/var/www/html" 这一段     #apache的根目录

把/var/www/html 这个目录改为/home/wwwroot/web1/htdocs

再找到 <Directory "/var/www/html">   #定义apache /var/www/html这个区域

把 /var/www/html改成/home/wwwroot/web1/htdocs

这样我们就把apahce的默认路径改掉了

service httpd restart  #重启Apache服务器

2、访问localhost的时候,会发现访问拒绝,这是为什么呢?

主要是因为你的/home/wwwroot/web1/htdocs的权限是750,apache这个用户没有权限访问,你需要更改掉权限,可以这样改

chmod -R 755 /home/wwwroot/web1/htdocs

然后去访问 发现正常运行了(apache的用户:apache 运行apache的组:apache)

至此,Apache默认网站目录更改成功。

使用备注:
个人CentOS网站目录改成 “ /home/jianbao/www/html ”

CentOS Linux系统下更改Apache默认网站目录的更多相关文章

  1. CentOS 6.8下更改Apache默认网站安装目录

    首先,当我们搭建好LAMP环境后,Apache服务器默认的网站安装目录是/var/www/html 然而我们搭建项目时为了方便,我们是按照自己的意愿更改网站目录的 现在假设,按照意愿设定的网站目录为/ ...

  2. CentOS 更改Apache默认网站目录

    http://www.osyunwei.com/archives/789.html引言:Apache默认的网站目录是在/var/www/html, 现在要把网站目录更改到/home/wwwroot/w ...

  3. Centos7 系统下怎么更改apache默认网站目录

    当我们在Centos7中配置好Apache时,发现apache默认解析目录是在 /var/www/html,也就是说当访问服务器 IP 或者本地 localhost 时,默认定位到这个目录里的 ind ...

  4. Centos7 系统更改apache默认网站目录(解决You don't have permission to access / on this server问题)

    当我们在Centos7中配置好Apache时,发现apache默认解析目录是在 /var/www/html,也就是说当访问服务器 IP 或者本地 localhost 时, 默认定位到这个目录里的 in ...

  5. linux系统下安装apache与tomcat

    apache的安装 把安装包放到/soft 下 [root@localhost ~]#cd /soft [root@localhost soft]#tar jxvf httpd-2.2.25.tar. ...

  6. 更改Apache默认网站根目录

    Apache服务器网站根目录配置是个比较基本的操作,之前经常用,现在记一下笔记 打开Apache的配置文件,一般在Apache安装目录下的conf/httpd.conf配置文件中修改, 找到 Docu ...

  7. CentOS Linux系统下安装Redis过程和配置参数说明

    转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/102.html?1455869303 安装过程: 代码如下: wget h ...

  8. CentOS 5.5 下修改Apache默认端口80

    打开  /etc/httpd/conf/httpd.conf  文件 修改两个地方     #Listen 12.34.56.78:80     Listen 80 #把80改为你设置的端口,我设置端 ...

  9. XAMPP修改Apache默认网站目录htdocs的详解

    XAMPP(Apache+MySQL+PHP+PERL)是一个功能强大的建 XAMPP 软件站集成环境包,大量站长在使用.正确安装好XAMPP后,默认是必须将php程序放到xampp\htdocs文件 ...

随机推荐

  1. CF732D. Exams[二分答案 贪心]

    D. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...

  2. python BeautifulSoup模块的简要介绍

    常用介绍: pip install beautifulsoup4 # 安装模块 from bs4 import BeautifulSoup # 导入模块 soup = BeautifulSoup(ht ...

  3. [codevs 2800]送外卖

    题目描述 Description 有一个送外卖的,他手上有n份订单,他要把n份东西,分别送达n个不同的客户的手上.n个不同的客户分别在1~n个编号的城市中.送外卖的从0号城市出发,然后n个城市都要走一 ...

  4. bash/shell编程学习(2)

    先来复习上节重定向的用法: 1.快速清空文件 cat demo.txt < /dev/null 注:linux中有一个经典名言[一切皆文件],/dev/null可以认为是一个特殊的空文件,更形象 ...

  5. iis 使用 LocalDB 报错:provider: SQL Network Interfaces, error: 50

    在使用asp.net core读取localdb数据库时,报以下错误: 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误.未找到或无法访问服务器.请验证实例名称是否正确并且 S ...

  6. python 列表 总结

    在python里创建列表和字典非常简单,这里总结一下它们的常用方法 1.创建列表 myArry = ["one", "two", "three&quo ...

  7. Android开发的菜鸟小记

    1.主线程异常:添加网络连接: 2.权限异常: 3.空指针异常:NullException: 添加网络权限: DEBUG:Connected to the target VM, address: 'l ...

  8. 第二次团队作业 -- 预则立&&他山之石

    我说的都队 031402304 陈燊 031402342 许玲玲 031402337 胡心颖 031402203 陈齐民 031402209 黄伟炜 031402233 郑扬涛 一.团队任务计划 周数 ...

  9. 编译安装apache

    1.安装依赖库:“Development  Tools”  “Server Platform Development”  pcre-devel 2.安装apr,apr-util 从yum源安装或去ap ...

  10. Pyhont-Urllib

    urllib 方法 1 httpContent=urllib.urlopen(url) 2 fileName, httpContent= urllib.urlretrieve(url, filePat ...