Laravel在Cpanel上共享托管

时间:2019-09-16 03:23:18

标签: php laravel laravel-5 cpanel

我在线阅读了大多数文章,但没有一种解决方案有效。

我将项目安装在/home/projectname目录中,并创建了/home/projectname/public/username/public_html的符号链接

存储目录也已链接。

到目前为止,我已尝试关注

1)使用this答案设置文件权限

2)我检查了是否使用php -m命令安装了必要的扩展。

3)还尝试将文件从/home/projctname/public目录移到/home/public_html并更改必要的文件,例如server.phpindex.phpAppServiceProvider.php

以上方法均无效。

奇怪的是,如果我在index.html文件夹中有public,该文件和内容可以很好地访问,但是index.php文件没有执行。

我尝试从/home/projectname/public/index.php回显一些字符串,但似乎index.php未被执行。

我还能尝试解决什么问题?

谢谢

1 个答案:

答案 0 :(得分:0)

不确定这是否有帮助,但有两点需要检查。不确定正在运行什么操作系统,但是如果使用类似Ubuntu2的Apache2,则可以检查

sudo nano /etc/apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

确保index.php在第一位。然后您有一个虚拟主机文件吗?

<VirtualHost *:80>
    ServerName yourdomain.com

    ServerAdmin webmaster@localhost
    DocumentRoot /home/your-project/public

    <Directory /home/your-project>
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>