[记录] 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 ...
随机推荐
- python selenium right click on an href and choose Save link as... on Chrome.
From:https://stackoverflow.com/questions/42781483/right-click-on-an-href-and-choose-save-link-as-in- ...
- C/C++基础---算法概览
符号概念 beg和end表示元素范围的迭代器 beg2表示第二个序列开始位置迭代器,end2表示第二个序列末尾迭代器(如果有).如没有则假定系列2至少与beg end表示的范围一样大.beg和beg2 ...
- 知识点-jar包
JAR文件的全称是Java Archive File,意思就是Java档案文件.通常JAR文件是一种压缩文件,与常见的ZIP压缩文件兼容,同城也被称为JAR包.JAR文件与zip文件的去区别就是在JA ...
- spring4.0之一:简介
我们共同来构建更好的企业应用.Spring帮助全世界的开发团队构建简单.便携.快速和灵活的基于JVM的系统和应用.这两句话已经足以说明Spring的目标,它针对的领域是企业应用,这套框架构建的应用有着 ...
- Bisecting KMeans (二分K均值)算法讲解及实现
算法原理 由于传统的KMeans算法的聚类结果易受到初始聚类中心点选择的影响,因此在传统的KMeans算法的基础上进行算法改进,对初始中心点选取比较严格,各中心点的距离较远,这就避免了初始聚类中心会选 ...
- 学习笔记之TensorFlow
TensorFlow https://www.tensorflow.org/ An open source machine learning framework for everyone Tensor ...
- HttpServletRequest接收参数的几种方法
HttpServletRequest接收参数的几种方法 我们经常用servlet和jsp, 经常用request.getParameter() 来得到数据. request.getParameter( ...
- python报错'str' object is not callable
>>> x=1.235 >>> int(x) 1 >>> str="fsgavfdbafdbntsbgbt" >> ...
- 搭建postgresql集群的问题汇总
问题一:如何配置pg远程访问 修改postgresql.conf-->listen_addresses = '*' 修改pg_hba.conf-->添加 ...
- ES6核心内容讲解
ECMAScript 6(以下简称ES6)是JavaScript语言的下一代标准.因为当前版本的ES6是在2015年发布的,所以又称ECMAScript 2015. 也就是说,ES6就是ES2015. ...