Search code examples
drupal-7virtualhost

Home screen does not appear after creating Virtual Host in Drupal 7


I install Drupal 7.56 in my PC with MAMP.
After installation complete, drupal admin screen appears.

enter image description here


Then, I create virtual host named "cast.dev". When I type "cast.dev" in browser, it does not show anything and only shows "It works !".

enter image description here

I also create a front page. It does not show also.
Could anyone tell me which part am I need to do more? Thanks .


Solution

  • Try to add the follwing

    <VirtualHost *:80>
      ServerName myproject.local
      ServerAdmin webmaster@localhost
      DocumentRoot /home/user/path/to/myproject_folder
      <Directory /home/user/path/to/myproject_folder>
        Require all granted
        AllowOverride All
      </Directory>
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    

    Then restart your Apache using the following command.

    sudo service apache2 restart
    

    Set up localhost file by adding the following code on the 'hosts' file from 'etc'.

    127.0.0.1 myproject.local
    

    For this,edit hosts using gedit with the following command :

    sudo gedit /etc/hosts