mywebsite.com 安装 Magento 后显示 / 的索引
mywebsite.com shows index of / after installing Magento
我是 运行 虚拟服务器:
- VirtualBox v5.2.12
- Ubuntu v18.04
- Apache v2.4.29
- php 7.1.17
- Magento v2.2.4
一切顺利,直到我安装 magento! Magento 在服务器上没有任何问题,但问题是当我输入 mywebsite.com 它显示我的文件和索引,我想显示我的 index.html 而不是 :
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
我尝试了很多答案,但都没有成功。
这里是/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>
这里是 /etc/apache2/sites-available/mywebsite.com.conf
Listen 65533
<VirtualHost mywebsite.com:65533>
ServerName www.mywebsite.com
ServerName mywebsite.com
ServerAdmin info@mywebsite.info
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>
这里是/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>
我终于解决了这个问题..已经尝试了一个星期!
解决方法是:
步骤 1- 在此文件“/etc/apache2/sites-available/mywebsite.com.conf”中,这应该是 virtualhsost 信息之后的第一个目录海峡:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
它会影响整个文件..到目前为止一切顺利。
第 2 步-我专门为 magento 添加了一个新目录
<Directory /var/www/mywebsite.com/html/magento2>
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Require all granted
</Directory>
第 3 步 - sudo /etc/init.d/apache2 restart
以重新启动带有状态的 apache 或仅使用任何方法重新启动。
** 这里的要点是您需要避免目录继承/一个设置,以便单独使用每个目录。
希望有人能从中受益post。
谢谢 Andra 的帮助。
此致,
QLF
我是 运行 虚拟服务器:
- VirtualBox v5.2.12
- Ubuntu v18.04
- Apache v2.4.29
- php 7.1.17
- Magento v2.2.4
一切顺利,直到我安装 magento! Magento 在服务器上没有任何问题,但问题是当我输入 mywebsite.com 它显示我的文件和索引,我想显示我的 index.html 而不是 :
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
我尝试了很多答案,但都没有成功。
这里是/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>
这里是 /etc/apache2/sites-available/mywebsite.com.conf
Listen 65533
<VirtualHost mywebsite.com:65533>
ServerName www.mywebsite.com
ServerName mywebsite.com
ServerAdmin info@mywebsite.info
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>
这里是/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>
我终于解决了这个问题..已经尝试了一个星期!
解决方法是: 步骤 1- 在此文件“/etc/apache2/sites-available/mywebsite.com.conf”中,这应该是 virtualhsost 信息之后的第一个目录海峡:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
它会影响整个文件..到目前为止一切顺利。
第 2 步-我专门为 magento 添加了一个新目录
<Directory /var/www/mywebsite.com/html/magento2>
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Require all granted
</Directory>
第 3 步 - sudo /etc/init.d/apache2 restart
以重新启动带有状态的 apache 或仅使用任何方法重新启动。
** 这里的要点是您需要避免目录继承/一个设置,以便单独使用每个目录。
希望有人能从中受益post。
谢谢 Andra 的帮助。
此致, QLF