Apache2简单配置
1.安装Apache2
sudo apt-get update
sudo apt-get install apache2.启动服务
sudo /etc/init.d/apache2 start # start | restart | stop
或
service apache2 start | restart | stop3.配置虚拟站点
在sites-available目录下配置自己的虚拟站点
cd /etc/apache2/sites-available进入sites-avaliable目录后,有两个默认的配置文件
ls
000-default.conf default-ssl.conf对 000-default.conf 进行复制,重命名为自己的域名,但是后缀必须是.conf
cp 000-default.conf www.91porn.com进入自己的的配置文件进行配置
<VirtualHost *:80>
ServerName www.91porn.com #站点域名
DocumentRoot /var/www/www.91porn.com #站点根目录
</VirtualHost>
#基本配置,根据需求在此基础上修改进入apache2目录下的sites-enabled目录,创建软连接
cd ../sites-enabled
ln -s ../sites-available/www.91porn.com.conf www.91porn.com.conf(更具需求可以修改主配置文件,主配置文件为apache2目录下的apache2.conf)
重启apache服务,如果不报错就表示配置成功
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本文内容仅供个人学习/研究/参考使用,不构成任何决策建议或专业指导。分享/转载时请标明原文来源,同时请勿将内容用于商业售卖、虚假宣传等非学习用途哦~感谢您的理解与支持!