【问题标题】:Deploying web application in GoDaddy Linux Hosting在 GoDaddy Linux 主机中部署 Web 应用程序
【发布时间】:2018-08-18 20:07:06
【问题描述】:

我正在尝试将 laravel 应用程序部署到 godaddy linux 主机。我在引用我购买的域要使用的 laravel 文件夹中的公共/索引时遇到问题。

我已经看到教程在托管根目录(公共)的公共文件夹中移动文件。我想尽可能避免在文档根目录中移动公共文件,因为我将在那里托管多个 Web 应用程序。有没有办法做到这一点?

网站索引为http://filcaspro.com/site/public。我想在访问网站时删除/site/public

【问题讨论】:

  • 你可以将你的域挂载到 laravel 项目文件夹中的 public 文件夹,就这么简单

标签: laravel


【解决方案1】:

我了解你的情况。这样做

让我们考虑一下名为“网站”的主题项目

原来“网站”目录是这样的。

 - app
 - bootstrap
 - config 
 - database
 - public
 - ...
 - vendor
 - .env
 - artisan
 - composer.json

现在这就是你需要做的。将所有内容分组到文件夹名称“网站”(您的主题项目全部或您想要的名称),但“公共文件夹”除外

你应该有这样的目录。

- website
    - app
    - bootstrap
    - ...
    - .env
    - composer.json
- public

现在对于公用文件夹,将所有内容移到外面,看起来像这样。

- website
  - app
  - bootstrap
  - ...
  - .env
  - composer.json
- index.php
- .htaccess
- (your assets css/js/images files)

你快到了,我们应该只需要编辑 index.php 来自

require __DIR__.'/../bootstrap/autoload.php'; 

require __DIR__.'/website/bootstrap/autoload.php';  //where website is the new foldername

$app = require_once __DIR__.'/../bootstrap/app.php';

$app = require_once __DIR__.'/wesbite/bootstrap/app.php';

现在应该可以了。并且无需通过“/public”文件夹访问即可在 goDaddy 或 cpanel 中的任何共享主机中运行网站。

【讨论】:

    猜你喜欢
    • 2013-04-09
    • 1970-01-01
    • 2018-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多