Set a virtualhost on you computer in Ubuntu
来源:互联网 发布:泉州广电网络营业厅 编辑:程序博客网 时间:2024/04/27 10:21
看到别人无比绚丽的网站,自己是不是也想有一个属于自己的网站呢?其实在自己的电脑上搭建一个website也不是一件很难的事情。
我是一个linux新手,对于网络也是刚刚入门,所谓初生牛牍不怕虎呀。呵呵,just try。
首先我用的是ubuntu 11.4的 操作系统,接下来我们开始行动吧!
第一步:下载apache,下载之后当然就是安装啦
(ctrl +shift+T)打开一个ternimal.查看在软件包中是否有apache
在命令行输入:aptitude search apache
如果有这个东东呢!!在apache前面将会有一个i标签,木有的话就是p了。
是p的话傻子都知道要装一个了。
在命令行输入:sudo aptitude install apache2,慢慢的等呀等。
第二步:安装数据库和php貌似也变成了一个简单的stuff了。
aptitude search phpmyadmin (记得判断哦)
sudo aptitude installphpmyadmin
aptitude search php
sudo aptitude install php5
第三步:创建虚拟主机:
首先需要创建网站目录。(以example.com为例)
sudo mkdir -p /srv/www/example.com/public_html(连环创建)
if you failed try:
cd /srv/www/
sudo mkdir example.com
cd example.com/
sudo mkdirpublic_html
这样创建的文件夹就成功了。
切换路径:cd /etc/apache2/sites-available/(正确的话可以TAB自动补全路径)
sudo gedit example.com就是我们要创建的网站了。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName example.com
ServerAlias www.example.com
DocumentRoot /srv/www/example.com/public_html/
</VirtualHost>
这样一个网站就基本上部好了。
做完这些之后需要的就是重启apache
sudo a2ensite example.com
sudo /etc/init.d/apahce2 reload (or restart)
Thinking for a little time,我需要吧这个目录强行指向本地
sudo gedit /etc/hosts
添加代码:
127.0.0.1 example.com;(这样example.com指向的就是本机。)
这样在一台虚拟的服务器就在本机上搭建成功。
(你可以检查网站是否成功,可以看/etc/apache2/sites-enabled 文件夹内example.com是否存在)
- Set a virtualhost on you computer in Ubuntu
- A provisioning profile named embedded.mobileprovision already exists on this computer. Do you want
- Give you a Set
- How To Set Up Database Replication In MySQL On Ubuntu
- Invoke a function in computer
- A*- not a star in the space, it's on you hands
- You may not call SetData on a resource while it is actively set on the GraphicsDevice. Unset it from
- List the UTC Time on a Computer
- How do you set, clear and toggle a single bit in C?
- Pure A set of small, responsive CSS modules that you can use in every web project.
- 9 Signs You Should Use Linux on Your Computer
- Ubuntu/Vistadual-boot(reference the the steps of installing Windows Vista on a computer which already have an Ubuntu installatio
- A Brief Tutorial on Git in Ubuntu 16.04
- 41.You have recently collected statistics on certain objects of a schema in your database. But you o
- No compiler is provided in this environment. Perhaps you are running on a JRE
- 【maven】No compiler is provided in this environment. Perhaps you are running on a JRE
- No compiler is provided in this environment. Perhaps you are running on a JRK
- No compiler is provided in this environment. Perhaps you are running on a JR
- 通过代理操作文档中的域(增、删、改、拷贝)
- Red Hat Linux使用yum 安装报 关于Public key for *.rpm is not installed 的解决方法
- SAP历史/历史明细表
- Request_irq参数dev_id的真正作用
- commons-logging和Log4j?
- Set a virtualhost on you computer in Ubuntu
- 二十五个顶级PHP模板引擎
- Oracle10g数据库exp、imp命令使用
- js验证手机号码和固话电话号码
- Delphi实现WebService带身份认证的数据传输
- VS2005中关于.sln,.suo,.ncb文件的可能的一些问题
- Android多点触控开发原理
- Linux函数库搜索路径、链接、依赖
- Web开发人员速查卡