【问题标题】:Deploying laravel to NAS将 laravel 部署到 NAS
【发布时间】:2016-08-11 15:44:13
【问题描述】:

在过去的两周里,我一直在纠结这个问题。

我正在尝试将我的 laravel 4.2 应用程序部署到我的服务器,但无法通过主页。在我的本地主机上一切正常。

当我点击一个链接时,我得到一个 404 错误。

我已经将我的 httpd.conf 文件设置为:AllowOverwride All 我还把我的 htacces 文件放在了公共文件夹中。

我的路线.php:

     Route::get('/', function()
{
    return View::make('index');
});


//Contact Page
Route::get('contact', 'ContactController@getContact');
Route::resource('producten','ProductsController');
//Form request:: POST action will trigger to controller
Route::post('contact_request','ContactController@getContactUsForm');
Route::get('info', function()
{
    return View::make('info');
});

Route::get('diensten', function()
{
    return View::make('diensten');
});

Route::get('tarieven', function()
{
    return View::make('tarieven');
});

paths.php 文件片段:

|--------------------------------------------------------------------------
    |
    | The public path contains the assets for your web application, such as
    | your JavaScript and CSS files, and also contains the primary entry
    | point for web requests into these applications from the outside.
    |
    */

    'public' => __DIR__.'/../public',

    /*
    |--------------------------------------------------------------------------
    | Base Path
    |--------------------------------------------------------------------------
    |
    | The base path is the root of the Laravel installation. Most likely you
    | will not need to change this value. But, if for some wild reason it
    | is necessary you will do so here, just proceed with some caution.
    |

htacces 文件:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
Options +FollowSymLinks
    RewriteEngine On
RewriteBase /
    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ public/index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Httpd.conf 文件:

User http
Group http

NameVirtualHost *:80
NameVirtualHost *:443

ServerAdmin admin
ServerName *

<VirtualHost _default_:80 _default_:443>
DocumentRoot "/var/services/web/pcvoorne.nl/public"
Include conf/extra/mod_fastcgi.conf
</VirtualHost>

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>

<Directory "/var/services/web">
    Options MultiViews FollowSymLinks ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html index.htm index.cgi index.php index.php5
</IfModule>

<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

ErrorLog /run/apache22-error_log
#ErrorLog /dev/null
TraceEnable off

我缺少什么来完成这项工作? 希望你能帮助我:)

【问题讨论】:

    标签: php apache laravel synology


    【解决方案1】:

    抱歉,必须确认一下:是否安装了 mod_rewrite?很高兴看到有关 404 错误的更多详细信息。你看到'/'上的索引了吗?

    【讨论】:

    • 请正确使用@stackoverflow。您应该只在 cmets 中提问(以询问更多信息)而不是在答案中提问。回答功能只能用于回答问题发布者的问题,而不是用于询问更多信息。
    猜你喜欢
    • 2017-04-21
    • 1970-01-01
    • 1970-01-01
    • 2016-09-14
    • 2018-12-02
    • 1970-01-01
    • 1970-01-01
    • 2019-12-23
    • 2016-11-12
    相关资源
    最近更新 更多