1. 程式人生 > >ubuntu 多域名配置

ubuntu 多域名配置

在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 [email protected]


    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