[记录] Ubuntu 配置Apache虚拟站点
版本 Ubuntu 16.04
1 . 首先找到Apapche配置文件夹 /etc/apache2/
apache2.conf conf-enabled magic mods-enabled sites-available
conf-available envvars mods-available ports.conf sites-enabled
该文件夹下有以上配置文件
apache2.conf : apache配置主文件 配置站点根目录 全局配置等
sites-available :配置虚拟主机
sites-enabled : 持有/etc/apache2/sites-available目录下文件的链接,当Apache重启后,该目录中包含的站点将会被激活。如果apache上配置了多个虚拟机,每个虚拟机的配置文件都放在sites-available下,那么对于虚拟主机的停用,启动就是非常方便了,操作某个虚拟主机就不用动配置文件了
2. 在sites-available下创建虚拟站点 (eko.conf)
root@ubuntu:/etc/apache2/sites-available# ls
-default.conf default-ssl.conf eko.conf
配置文件项
<VirtualHost *:>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName eko.xiao.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/eko/public <Directory /var/www/html/eko/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
3 . 创建软链接
sudo ln -s /etc/apache2/sites-available/example.conf /etc/apache2/sites-enabled/example.conf
在Ubuntu缺省安装的目录有与其他相比有一点不同。在ubuntu中module和 virtual host的配置都有两个目录,一个是available,一个是enabled,available目录是存放有效的内容,但不起作用,只有用ln 连到enabled过去才可以起作用。这样子对于开发以及调试都很方便
4 . 修改/etc /hosts 文件,加入当前主机的IP地址和需要设置的虚拟主机名
127.0.0.1 localhost
127.0.1.1 ubuntu
192.168.1.121 eko.test.com
# The following lines are desirable for IPv6 capable hosts
:: ip6-localhost ip6-loopback
fe00:: ip6-localnet
ff00:: ip6-mcastprefix
ff02:: ip6-allnodes
ff02:: ip6-allrouters
5. 重启apache
/etc/init.d/apache2 restart
6 . 配置完成后将项目根目录 runtime 目录 public目录 权限设置为777
chmod -R 777 runtime
chmod -R 777 public/upload
[记录] Ubuntu 配置Apache虚拟站点的更多相关文章
- Ubuntu 配置Apache虚拟目录
http://blog.csdn.net/spring21st/article/details/6589300 Ubuntu 配置Apache虚拟目录 http://blog.csdn.net/spr ...
- 配置Apache虚拟主机
实验环境 一台最小化安装的CentOS 7.3虚拟机 配置基础环境 1. 安装apache yum install -y httpd 2. 建立虚拟主机的根目录 mkdir /var/wwwroot ...
- wamp开发环境配置之配置Apache虚拟主机
网站建设人员在本地测试时,常常不是一个网站,那怎么能像输入域名一样在地址栏上面输入“域名”就能本地访问该网站呢?这里就要配置Apache虚拟主机了! 1.找到apache\conf\httpd.con ...
- mac下配置Apache虚拟域名方案,以及遇到的坑(转)
1. 配置Apache虚拟域名 1.执行 sudo vi /etc/apache2/httpd.conf 开始配置httpd.conf 的文件; //配置listen 80端口(默认配置), ...
- mac下配置Apache虚拟域名方案,以及遇到的坑
1. 配置Apache虚拟域名 1.执行 sudo vi /etc/apache2/httpd.conf 开始配置httpd.conf 的文件; //配置listen 80端口(默认配置), ...
- ubuntu配置apache和cgi
ubuntu配置apache和cgi . 更新源并进行安装,否则后面的下载可能会不成功. sudo apt-get update sudo apt-get upgrade . 安装apache2服务 ...
- 配置LANMP环境(7)-- 配置nginx反向代理,与配置apache虚拟主机
一.配置nginx反向代理 1.修改配置文件 vim /etc/nginx/nginx.conf 在35行http下添加一下内容: include /data/nginx/vhosts/*.conf; ...
- 配置IIS虚拟站点(5)
开发完ASP.NET网站后,想要直接浏览,不通过开发环境,那么就需要配置IIS虚拟站点 1.开始菜单->控制面板->所有控制面板->管理工具->双击打开Internet信息服务 ...
- ubuntu配置apache的虚拟主机
ubuntu中apache的配置文件分散在几个文件中,/etc/apache2/apache2.conf将它们组织起来.这样设计有很多好处,这里就不在赘述了.进入正题: 1)配置文件在/etc/apa ...
随机推荐
- LeetCode – LRU Cache (Java)
Problem Design and implement a data structure for Least Recently Used (LRU) cache. It should support ...
- bzoj5044: 岛屿生成
Description 小Q设计了一款2D游戏,它的地图建立在二维笛卡尔坐标系上.这个游戏最大的特色就是可以随机生成地图,但是 岛屿生成却给小Q带来了巨大的麻烦.一个岛屿可以看成一个恰好有n个顶点的简 ...
- 服务链路追踪(Spring Cloud Sleuth)
sleuth:英 [slu:θ] 美 [sluθ] n.足迹,警犬,侦探vi.做侦探 微服务架构是一个分布式架构,它按业务划分服务单元,一个分布式系统往往有很多个服务单元.由于服务单元数量众多,业务的 ...
- 问题 H: 老管家的忠诚(线段树)
问题 H: 老管家的忠诚 时间限制: 0 Sec 内存限制: 128 MB提交: 54 解决: 21[提交][状态][讨论版][命题人:外部导入] 题目描述 老管家是一个聪明能干的 ...
- [UE4]AnimOffset偏移动画
在每个在偏移动画要用到的动画文件中设置中设置上图属性. 也可以选择多个动画文件:
- SQL SERVER 事务相关
1 准备数据 及 涉及到的几个设置 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED --设置事务会话的隔离等级(默认值为 READ UNCOMMIT ...
- MyBatis 工作原理
参考链接: 深入理解Mybatis原理:http://blog.csdn.net/luanlouis/article/details/40422941 MyBatis原理:http://www.jia ...
- Kaptcha
Kaptcha:google自动生成验证码组件 kaptcha的使用比较方便,只需添加jar包依赖之后简单地配置就可以使用了 kaptcha所有配置都可以通过web.xml来完成,如果你的项目中使用了 ...
- 第9章 应用层(4)_超文本传输协议HTTP
5. 超文本传输协议HTTP 5.1 统一资源定位符URL (1)URL的一般形式:<协议>://<主机>:<端口>/<路径> ①协议后面必须写上“:/ ...
- (转)C#读取MAC的几种方法
原文地址:http://www.cnblogs.com/diulela/archive/2012/04/07/2436111.html 1 通过IPConfig命令读取MAC地址 ///<sum ...