I installed magento 2.2.4 and (name directory SA ) i want to have in the url sa.com.tn and for admin sa.com.tn/interBO/admin so i tried to open sudo vi /etc/apache2/sites-available/magento2.conf but it is empty so how to do that and why this file is empty. please i need your help
- 6,126
- 2
- 23
- 65
- 1,603
- 2
- 14
- 47
2 Answers
Create configuration file for host
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/sa.com.conf
Now, modify the configuration files to match with our virtual hosts and put below code.
sudo gedit /etc/apache2/sites-available/sa.com.conf
<VirtualHost *:80>
ServerAdmin magento2@test.com
ServerName sa.com.tn
ServerAlias www.sa.com.tn
DocumentRoot /var/www/html/SA
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/SA>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Enable virtual host configuration files
sudo a2ensite sa.com.conf
Restart apache web server.
sudo service apache2 restart
Add your virtual host like below and put code.
gedit /etc/hosts
127.0.0.1 sa.com.tn
Now edit core_config_data table and put url here like below
- 3,409
- 1
- 12
- 30
-
thanks for your replay , what about the admin url how to change it – Developper Magento Oct 09 '18 at 12:57
-
For apache version 2.4 : Require all granted instead of Order allow,deny allow from all – Christophe Ferreboeuf Apr 12 '19 at 10:59
-
@Ansar can you help check out this question? https://magento.stackexchange.com/questions/294677/apache-virtual-host-setup-configuration-in-localhost-for-multiple-magento-sites thank you. – Mage Explorer Nov 05 '19 at 19:45
-
Great, thanks @ansar – Vivek Oct 12 '21 at 05:40
Magento 2.x is not supported Windows OS and Mac OS due security reasons however we can still install Magento 2 on Windows machine using XAMPP tool, but we must fix some known errors after installing on Windows system. Check this link for more details. https://www.howtoinmagento.com/2019/06/magento-2x-does-not-support-windows-mac.html
- 11
- 3