Issue
I am running Virtual server by:
- VirtualBox v5.2.12
- Ubuntu v18.04
- Apache v2.4.29
- php 7.1.17
- Magento v2.2.4
Everything goes fine till I install magento! Magento works find without any problem in the server but the problem here is when I entered mywebsite.com it shows my files and indexing and I want to show my index.html instead:
Index of /
Name Last modified Size Description
index.html 2018-05-28 03:47 180
info.php 2018-06-04 12:39 20
magento2/ 2018-05-01 23:21 -
Apache/2.4.29 (Ubuntu) Server at mywebsite.com Port 65533
I tried a lot of answer but without any success.
Here is /etc/apache2/apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
And Here is /etc/apache2/sites-available/mywebsite.com.conf
Listen 65533
<VirtualHost mywebsite.com:65533>
ServerName www.mywebsite.com
ServerName mywebsite.com
ServerAdmin [email protected]
ServerName mywebsite.com
ServerAlias www.mywebsite.com
DocumentRoot /var/www/mywebsite.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/mywebsite.com/html/>
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Here is /etc/apache2/sites-available/000-default.conf.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Solution
Finally I solved the issue .. been trying for a week!
The solution is: Step 1- Inside this file "/etc/apache2/sites-available/mywebsite.com.conf" this should be the first directory strait after the virtualhsost info:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
And it will effect the whole file.. ok so far so good.
Step 2- I added a new directory specially for magento which is
<Directory /var/www/mywebsite.com/html/magento2>
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Require all granted
</Directory>
Step 3- sudo /etc/init.d/apache2 restart
in order to restart the apache with status or just use any method to restart.
** The point here is you need to avoid directory Inheritance / one setting for all in order to work with each directory separately.
Hope someone get benefit from this post.
Thank you Andra for the little help.
Regards, QLF
Answered By - qlf