我刚刚在virtualbox上安装了一个Ubuntu服务器,并将我的laravel项目移到了它的/ html文件夹中 . 配置Laravel.conf和我的服务器之后,我就会看到:
它不显示公用文件夹,但我可以通过/ public访问它,但没有链接正常工作 . 这是我的Laravel.conf:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/public
ServerName 192.168.1.104
<Directory /var/www/html/public>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
谁知道我正在做什么错误?
2 回答
确保已启用重写模块 . 你可以通过跑步来做到这一点;
sudo a2enmod rewrite
然后使用sudo service apache2 restart
或sudo service apache2 reload
重新启动服务器 .第一个问题 the public folder is not showing but you can visit it . 这是因为
.htaccess
文件正在禁用包含公用文件夹的目录列表对于你的第二个问题 you are unable to visit laravel index page links 这是因为laravel重写url规则不起作用并启用它们你可以启用apache2重写模块如下:
然后重启你的网络服务器
现在你的问题应该修复 .