在Ubuntu 要配置 varwwwloelve 目录为 www.loelve.xyz 为例
一、打开:etchosts文件:sudo vim etchosts
添加:127.0.0.1 www.loelve.xyz
二、打开:etcapach2sites-available 00-default.conf文件:sudo vim etcapach2sites-available 00-default.conf
添加:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/loelve/public
ServerName www.loelve.xyz
<Directory "/var/www/loelve/public">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
三、重启apache
sudo service apache2 restart