1.安装Apache2 html
sudo apt-get update sudo apt-get install apache2
2.启动服务linux
sudo /etc/init.d/apache2 start # start | restart | stop 或 service apache2 start | restart | stop
3.配置虚拟站点apache
在sites-available目录下配置本身的虚拟站点vim
cd /etc/apache2/sites-available
进入sites-avaliable目录后,有两个默认的配置文件windows
ls 000-default.conf default-ssl.conf
对 000-default.conf 进行复制,重命名为本身的域名,可是后缀必须是.confspa
cp 000-default.conf www.91porn.com
进入本身的的配置文件进行配置rest
<VirtualHost *:80> ServerName www.91porn.com #站点域名 DocumentRoot /var/www/www.91porn.com #站点根目录 </VirtualHost> #基本配置,根据需求在此基础上修改
进入apache2目录下的sites-enabled目录,建立软链接code
cd ../sites-enabled ln -s ../sites-available/www.91porn.com.conf www.91porn.com.conf
(更具需求能够修改主配置文件,主配置文件为apache2目录下的apache2.conf)htm
重启apache服务,若是不报错就表示配置成功blog
sudo /etc/init.d/apache2 start # start | restart | stop 或 service apache2 start | restart | stop
配置虚拟站点
cd /var/www/blog
vim index.html #编辑html文件
在linux下设置域名解析
sudo vim /etc/hosts 127.0.0.1 www.blog.com
在windows下设置域名解析
C:\Windows\System32\drivers\etc\ 编写hosts文件
IP地址(站点主机名) www.blog.com