How to install Magento in virtual host?

Asked

Viewed 106 times

2

I’m trying to install Magento on my localhost using virtual host (so it can work) but even I’ve already created the file on /etc/apache2/sites-available with the name magento.conf with the code:

<VirtualHost *:80>
DocumentRoot /var/www/magento
<Directory /var/www/magento/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
</Directory>

In case I try to access http://magento.localhost apache page is normally loaded Apache2 Ubuntu Default Page and the folder files do not open so I can start the installation of the user.

Does anyone have any idea what might be going on?

1 answer

0

Add the option ServerName within your vhost, and check if the option NameVirtualHost this parameter is enabled (this parameter is global):

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName magento.localhost
    DocumentRoot /var/www/magento
    <Directory /var/www/magento/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
    </Directory>
</VirtualHost>

Other than that, I don’t see a problem.

  • <VirtualHost *:80>&#xA; DocumentRoot “/var/www/magento”&#xA; ServerName magento.localhost&#xA; ServerAlias magento.localhost&#xA; ErrorLog “/var/log/apache2/virtual-error.log”&#xA; CustomLog “/var/log/apache2/virtual-custom.log” common&#xA; &#xA; <Directory “/var/www/magento/”>&#xA; Options Includes FollowSymLinks&#xA; AllowOverride All&#xA; Order allow,deny&#xA; Allow from all&#xA; </Directory>&#xA;</VirtualHost> thus?

  • The ServerAlias is unnecessary because you are creating an alias equal to the server name (but I think this is no problem). Be sure to check if the parameter NameVirtualHost is configured correctly. Otherwise, it seems to be correct yes, considering that all paths are valid.

  • I made some changes here and now the page shows the error: You don’t have permission to access / on this server. server Unable to read htaccess file, Denying access to be safe

  • @Rafaelacioly check the permissions to the directory /var/www/magento and its files. Check which user Apache is running: it must have read permissions in the vhost directory and its files. If you want to do an easy test, fully release permissions using chmod -R 777 /var/www/magento. After it works, re-restrict permissions to a more secure value.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.