首页 > 学院 > 操作系统 > 正文

apache 站点配置

2024-06-28 16:01:36
字体:
来源:转载
供稿:网友

新建虚拟主机

<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName Ubuntuuc.cc ServerAlias ubuntuc.cc DocumentRoot /vagrant/public/uc/public ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>

修改hosts

127.0.0.1 ubuntuuc.cc

开启主机重写(.htaccess)支持

sudo a2enmod rewrite sudo vim /etc/apache2/mods-enabled/rewrite.load #进去开启

修改apache配置文件

<Directory /> Options FollowSymLinks AllowOverride All #All才会使用带主机重写 Require all granted #granted才能访问到网站</Directory>

重启apache2

sudo service apache2 restart
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表