美文网首页
Ubuntu下设置Apache2

Ubuntu下设置Apache2

作者: 黎小明少 | 来源:发表于2017-11-18 21:29 被阅读0次

Ubuntu版本为16.04

安装命令

sudo apt-get install apache2

更改默认目录

sudo subl /etc/apache2/apache2.conf

<Directory /var/www/> 改成 <Directory "你的目录">,可以将/var/www 中的默认网页复制到 你的目录 中

sudo subl /etc/apache2/sites-available/000-default.conf

DocumentRoot /var/www/html 改成 DocumentRoot "你的目录"

重启

sudo /etc/init.d/apache2 restart

启动Rewritea功能

sudo a2enmod rewrite

启动这个指令后,即启用了mod_rewrite模块。但要使rewtite生效,还需要配置:

sudo subl /etc/apache2/apache2.conf

<Directory "你的目录"> 往下的AllowOverride None 改为 AllowOverride All

然后重启服器即可

sudo /etc/init.d/apache2 restart

相关文章

网友评论

      本文标题:Ubuntu下设置Apache2

      本文链接:https://www.haomeiwen.com/subject/ezyyvxtx.html