Ubuntu 12.04 之 虚拟主机的配置
2024-10-20 13:37:04
Ubuntu 12.04 之 虚拟主机的配置
(1)打开etc/hosts文件
增加:
127.0.0.1 study.ubuntu.com
127.0.0.1 hello.ubuntu.com
127.0.0.1 test.ubuntu.com
(2)建立三个项目目录
sudo mkdir -p /wwwroot/{study,hello,test}
在每个项目里都建立一个Index.html
(3)配置apache的虚拟主机
切换到apache的配置目录:
cd /etc/apache2/sites-available/
复制三份配置文件:
sudo cp default study
sudo cp default hello
sudo cp default test
修改配置文件:
vim hello
内容:
ServerName hello.ubuntu.com 添加
DocumentRoot /wwwroot/hello 修改
<Directory /wwwroot/hello/> 修改
启动配置文件:
test@localhost:/etc/apache2/sites-available$ cd ../sites-enabled/
test@localhost:/etc/apache2/sites-enabled$ ll
ls: 初始化月份字符串出错
总用量
drwxr-xr-x root root 7Ղ : ./
drwxr-xr-x root root 7Ղ : ../
lrwxrwxrwx root root 7Ղ : -default -> ../sites-available/default
test@localhost:/etc/apache2/sites-enabled$
需要分别创建三个软连接,分别指向刚才复制的三个配置文件。
sudo ln -s ../sites-available/hello hello
sudo ln -s ../sites-available/test test
sudo ln -s ../sites-available/study study
重启apache:sudo service apache2 restart
然后就可以访问
hello.ubuntu.com
study.ubuntu.com
test.ubuntu.com
最新文章
- 创建Mat对象的几种方法
- Android想服务器传图片,透过流的方式。还有读取服务器图片(文件),也通过流的方式。
- [转载]Vivado轻松实现IP封装
- 深入理解line-height与vertical-align
- JAVA面向对象程序设计——实验报告
- c++虚函数的作用是什么?
- (转载)SQL Server 2005 如何启用xp_cmdshell组件
- 看牙与IT项目
- bootstrap static popover
- java jfinal + ajaxfileupload.js 上传
- 小结JS中的OOP(上)
- remove方法
- Win7共享文件夹简单?这个共享问题可以难倒90%的人
- mysql 开发进阶篇系列 50 表的数据导入(load data infile,mysqlimport )
- mysql基础整理01
- UCML异常提示:无效URI
- linux source code search
- Oracle 报错:PLS-00201: 必须声明标识符
- 关于python最大递归深度 - 998
- input 数字输入控制(含小数)