在Ubuntu 要配置 \var\www\laravel 目录为 www.loelve.xyz 为例
一、打开:\etc\hosts文件:sudo vim \etc\hosts
添加:127.0.0.1 www.loelve.xyz
二、打开:\etc\apach2\sites-available\000-default.conf文件:sudo vim \etc\apach2\sites-available\000-default.conf
添加:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/laravel/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