Benji40
Benji40

Reputation: 237

Deploy Laravel on 1&1 Servers

I have recently completed my first laravel site, but now I am stuck with deployment. This is an entirely new concept for me. My webspace is supplied by 1&1.

I have attempted several tutorials, but none seem to work. Based on the tutorial here at: Uploading Laravel Project onto Web Server

I structured my server folders like so:

(note when first FTPing my server, there was no www or html_docs, only a logs folder).

enter image description here

In the www, my index.php was altered to:

require __DIR__.'/../laravel/bootstrap/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/start.php';

In the laravel/bootstrap/paths.php file I altered:

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

When visiting my domain in a browser, for example: myDomain.co.uk - the site is redirected to a "placeholder" (named /defaultsite) page for 1&1 domains and states "This domain name has just been registered."

If I append /www/index.php for example, I get file does not exist, even though the file is residing in my structure above.

As you probably noticed I am very new to server side aspects such as FTPing ect. I have read a few tuts, and all seem to take a different approach, leaving me confused to the best method. I am not sure where to go from here, so any advice is appreciated. Thank you.

Edit: I think I actually got it working, but now when I go to domain.com/public I get what I think is a DB error:

SQLSTATE[HY000] [2002] No such file or directory.

Any Advice please?

Upvotes: 2

Views: 4221

Answers (2)

Timothy Bracken
Timothy Bracken

Reputation: 94

The reason you are seeing /public/index.php is because you are pointing to the top level directory and not the /public directory. To fix this go to:

  1. Manage domains
  2. Expand your domain and click "Edit Destination"
  3. Change the destination directory to /public/.

This should remove public from the URL.

This is the .htaccess file I use for 1and1 and laravel 4.2 and it removes .index.php and also uses an updated version of PHP:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    AddHandler x-mapp-php6 .php
    AddType x-mapp-php6 .php

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

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

</IfModule>

Upvotes: 4

Benji40
Benji40

Reputation: 237

All fixed :) turns out 1&1 do not host their db name as local host, or 121.0.0.1. I simply changed the details and works a dream. next step is to get rid of the terrible /public/index url.

Upvotes: 1

Related Questions