Modify the apache2 default document and home page on ubuntu (ubuntu下修改apache2默认目录和默认主页)
- Change the apache2 default website directory
As we know, The apache2 default directory at /var/www/,If you want to modify it or you have some virtual hosts,You need to find the file which in "/etc/apache2/sites-enabled/000-default",Use vi editor and look for the "DocumentRoot" and Modify to your path.(Don`t forget restart your apache2 service ! ! !)
root@root:/etc/apache2/sites-enabled# ls
000-default.conf
root@root:/etc/apache2/sites-enabled# vi 000-default.conf
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
- Change the apache2 default home page.
The apache2 default home page file at /etc/apache2/apache2.conf , This is a important file . I suggest you`d better to backup it before you modify it .After you enter this file,you need add "your site file name" behind "DirectoryIndex" , But,The "DirectoryIndex" locations are diffierent with diffierent versions . At this time , you should press the order "grep -iR DirectoryIndex" ,and then it will show you:
root@root:/etc/apache2# grep -iR DirectoryIndex
mods-available/dir.conf: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm /myblog
mods-enabled/dir.conf: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm /myblog
You must feeling strange , Why do two files have same content? Because files in "mods-enabled" are all links to "mods-available" , So you just modify either of the two.
Thanks for your browsing !
- 修改apache2默认网站目录
我们都知道,apache2默认目录是在/var/www/,假如你想去修改或者你有一些虚拟主机的话,你需要找到"/etc/apache2/sites-enabled/000-default“,使用VI编辑器并且找到”DocumentRoot“ 然后修改成你的路径。(不要忘记重启你的apache2服务!!!)
- 修改默认主页
apache2 的默认主页文件在/etc/apache2/apache2.conf,这是个比较重要的文件,我建议你修改前备份,进入这个文件后,你需要在”DirectoryIndex“后面添加"你的站点主页文件夹名称",但是,因为不同版本的apache,”DirectoryIndex“文件位置也不一样,在这个时候,你需要按下命令”grep -iR DirectoryIndex“,然后会出现如下:
你一定会觉得奇怪,为什么会出现两个一样内容的文件?因为啊在”mods-enabled“文件夹的所有文件都是”mods-available“文件夹里面文件的链接,所以你只需要修改任意两者之一。
感谢你的浏览!
Modify the apache2 default document and home page on ubuntu (ubuntu下修改apache2默认目录和默认主页)的更多相关文章
- ubuntu下修改apache2.4的rewrite
sudo a2enmod rewrite 修改/etc/apache2/apache2.conf中 AllowOverride None 为 AllowOverride ALL 重启 service ...
- Default Document <defaultDocument> IIS中的默认页面
https://docs.microsoft.com/en-us/iis/configuration/system.webserver/defaultdocument/index Default do ...
- Opening Default document on IIS (HTML With WebAPI)
Question: I've a deployed ASP.NET Web API with a website on the same folder that consume it. When I ...
- Ubuntu Server 14.04 & Apache2.4 虚拟主机、模块重写、隐藏入口文件配置
环境: Ubuntu Server 14.04 , Apache2.4 一.Apache2.4 虚拟主机配置 01. 新建一份配置文件 在apache2.4中,虚拟主机的目录是通过/etc/apach ...
- 【ubuntu】Ubuntu 修改 Apache2 运行用户/用户组及修改方法
我们在安装apache后,有时在上传文件的时候,提示没有权限或者是不可写,我们都会去查文件夹的权限.通过ls -l /var/www/html/website可以很直观的看出我们文件和文件夹的权限,d ...
- 在ubuntu上安装svn+apache2
参考网站: http://www.thinksaas.cn/group/topic/335434/ http://blog.sina.com.cn/s/blog_3eba8f1c0100dqk1.ht ...
- ubuntu14.04下直接修改apache2默认目录导致wordpress样式改变的解决办法
一开始看到网上有各种各样的解决方法: 第一种是直接将 sites-available目录下的000-default.conf中的下列代码: DocumentRoot /var/www/html 修改为 ...
- ubuntu-14.04服务器版下搭建apache2+svn+svnmanager服务
本人linux小白,新进公司,被分配此任务,好崩溃,只能一边百度linux命令一边完成任务.从装系统开始一直到搭建好服务,也快一周了,足见水平之差,以下博文基本靠网络,再加上自己的摸索,直至搭建成功. ...
- CentOS6.5下安装apache2.2和PHP 5.5.28
CentOS6.5下安装apache2.2 1. 准备程序 :httpd-2.2.27.tar.gz 下载地址:http://httpd.apache.org/download.cgi#apache2 ...
随机推荐
- drupal对数据库操作
// nodenode_load($nid = NULL, $vid = NULL, $reset = FALSE);node_load_multiple($nids = array(), $cond ...
- css一个很好用的hover显示
之前一直想在样式实现,hover时显示其他div,今天终于找到了,(*^▽^*) .a悬停时显示.b .a:hover .b { display: block; }
- 深入理解Javascript之执行上下文(Execution Context)
在这篇文章中,将比较深入地阐述下执行上下文 - Javascript中最基础也是最重要的一个概念.相信读完这篇文章后,你就会明白javascript引擎内部在执行代码以前到底做了些什么,为什么某些函数 ...
- mac 上配置 maven
1. 将maven压缩包解压至/Users/suqiuhui/Applications目录下的新建文件夹dev下 2. 打开终端(系统根目录,~/下) 3. 如果没有 .bash_profile 文件 ...
- 上传文件到Maven仓库
1.上传jar到本地仓库 mvn install:install-file -DgroupId=org.csource -DartifactId=fastdfs-client-java -Dversi ...
- solidity语言13
函数过载 合约内允许定义同名函数,但是输入参数不一致 pragma solidity ^0.4.17; contract A { function f(uint _in) public pure re ...
- 【Leetcode】【Easy】Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head. For example, Give ...
- Vaadin学习笔记——Page、UI和View在用法上的区别
前言 在Vaadin技术框架中会出现三种不同的类,用于架构Web应用.它们分别是:Page.UI.View.本文将对这三者从使用角度进行比较,试图分析三者的异同.本文完全原创,我可不是在强调版权,我只 ...
- Perl实用中文处理步骤(修改版)
发信人: FenRagwort (泽), 信区: Perl标 题: Perl实用中文处理步骤(修改版)发信站: 水木社区 (Mon Feb 14 12:52:14 2011), 转信 (修改版 感谢 ...
- 第二次scrum冲击
1.小组第二次冲刺任务及其完成情况描述. 本次冲刺我们小组经过讨论,实现的使我们爱上长大系统中的失物招领功能,由于在实际的实现中,对于本功能的逐渐深入和了解,渐渐发现这个功能实现起来需要由很多部分组成 ...