step by step入门LAMP配置
2013-01-07 19:13
471 查看
安装apache2参见《step by step学习LAMP配置》一文。
环境:
虚拟机上安装的debian系统
apache2
python2.6
mysql5.5
一、入门:搭建一个简单的网页“Welcome to my blog~”
该部分介绍如何在apache上搭建一个简单web应用,会搭建两个虚拟机,分别对应不同的port,共享一个ip。
1.编写虚拟机配置文件
cp /etc/apache2/sites-avaliable/default /etc/apache2/sites-avaliable/blog.mytest.com
cp /etc/apache2/sites-avaliable/default /etc/apache2/sites-avaliable/cici.com
default文件是apache自带的虚拟机配置文件,因此这里不用自己编写,拷贝两份修改就ok了~
2.编辑虚拟机配置文件
vim /etc/apache2/sites-avaliable/blog.mytest.com
修改 <VirtualHost *:80>为 <VirtualHost *:8080>
DocumentRoot改为需要将网页源文件保持的路径:eg:DocumentRoot /home/cici/www/blog.mytest.com/
修改相应的: <Directory /home/cici/www/blog.mytest.com/>
然后vim /etc/apache2/sites-avaliable/cici.com做类似的修改,但是该虚拟机的port设置为8081,路径也需要更改为期望指定的路径
3.执行
ln -s /etc/apache2/sites-avaliable/blog.mytest.com /etc/apache2/sites-enabled/blog.mytest.com
ln -s /etc/apache2/sites-avaliable/cici.com /etc/apache2/sites-enabled/cici.com
在sites-available里面的文件是有效的虚拟主机配置,只要将其连接到site-enabled目录下才能真正生效;
4.执行
vim /etc/apache2/httpd.conf
添加语句ServerName localhost
5.执行vim /etc/apache2/ports.conf配置server的监听端口
添加Listen 8080和Listen 8081
6.执行service apache 2 restart
7.在/home/cici/www/blog.mytest.com/目录下创建一个index.html文件
<h1>Welcome to my blog~</h1>
8.在可以互相通讯的client上,用浏览器访问server_ip:8080,就能看到页面打印出“Welcome to my blog~”信息了~!
9.此外可以用a2ensite cici.com或是a2dissite cici.com激活或是注销某个虚拟机。
环境:
虚拟机上安装的debian系统
apache2
python2.6
mysql5.5
一、入门:搭建一个简单的网页“Welcome to my blog~”
该部分介绍如何在apache上搭建一个简单web应用,会搭建两个虚拟机,分别对应不同的port,共享一个ip。
1.编写虚拟机配置文件
cp /etc/apache2/sites-avaliable/default /etc/apache2/sites-avaliable/blog.mytest.com
cp /etc/apache2/sites-avaliable/default /etc/apache2/sites-avaliable/cici.com
default文件是apache自带的虚拟机配置文件,因此这里不用自己编写,拷贝两份修改就ok了~
2.编辑虚拟机配置文件
vim /etc/apache2/sites-avaliable/blog.mytest.com
修改 <VirtualHost *:80>为 <VirtualHost *:8080>
DocumentRoot改为需要将网页源文件保持的路径:eg:DocumentRoot /home/cici/www/blog.mytest.com/
修改相应的: <Directory /home/cici/www/blog.mytest.com/>
然后vim /etc/apache2/sites-avaliable/cici.com做类似的修改,但是该虚拟机的port设置为8081,路径也需要更改为期望指定的路径
3.执行
ln -s /etc/apache2/sites-avaliable/blog.mytest.com /etc/apache2/sites-enabled/blog.mytest.com
ln -s /etc/apache2/sites-avaliable/cici.com /etc/apache2/sites-enabled/cici.com
在sites-available里面的文件是有效的虚拟主机配置,只要将其连接到site-enabled目录下才能真正生效;
4.执行
vim /etc/apache2/httpd.conf
添加语句ServerName localhost
5.执行vim /etc/apache2/ports.conf配置server的监听端口
添加Listen 8080和Listen 8081
6.执行service apache 2 restart
7.在/home/cici/www/blog.mytest.com/目录下创建一个index.html文件
<h1>Welcome to my blog~</h1>
8.在可以互相通讯的client上,用浏览器访问server_ip:8080,就能看到页面打印出“Welcome to my blog~”信息了~!
9.此外可以用a2ensite cici.com或是a2dissite cici.com激活或是注销某个虚拟机。
相关文章推荐
- Enterprise Library Step By Step系列(一):配置应用程序块——入门篇
- step by step学习LAMP配置
- Linux5.8下配置web服务器-入门级指导手册(step by step)
- Coherence Step by Step 第一篇 入门(三)配置(翻译)
- Enterprise Library Step By Step系列(一):配置应用程序块——入门篇
- Enterprise Library Step By Step系列(一):配置应用程序块——入门篇
- Enterprise Library Step By Step系列(一):配置应用程序块——入门篇
- 深入浅出C#2008从入门到提高Step By Step(五)Windows应用程序常用控件类(1)-Form
- Enterprise Library Step By Step系列(三):数据访问程序块——入门篇
- Enterprise Library Step By Step系列(七):日志和监测应用程序块——入门篇
- Enterprise Library Step By Step系列(十一):异常处理应用程序块——入门篇
- Visual.C#.2010从入门到精通].(Visual.C#.2010.Step.By.Step)读书笔记 索引器(十五)
- 深入浅出C#2008从入门到提高Step By Step(七)数据访问(2)-DataSet
- CANoe 入门 Step by step系列(二)CAPL编程
- 在VMWare中配置SQLServer2005集群 Step by Step(二)——配置虚拟机
- Step by Step:Linux C多线程编程入门(基本API及多线程的同步与互斥)
- 在VMWare中配置SQLServer2005日志传送 Step by Step(二)——配置和测试
- Dataguard配置Step by Step
- Postfix配置Step By Step(三)
- Enterprise Library Step By Step系列(五):安全应用程序块——入门篇