apache 站点配置

新建虚拟主机

<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

猜你喜欢

转载自blog.csdn.net/w786572258/article/details/54926725
今日推荐