2

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?

Community
  • 1
  • 1
Benji40
  • 217
  • 1
  • 5
  • 12
  • Is the HTTP server document root set to the `www` directory? – Bogdan Feb 05 '15 at 19:27
  • Forgive the stupid question, but where is that located, I am meddling with things for the first time. Thanks for the swift reply. – Benji40 Feb 05 '15 at 19:35
  • Not really sure where you'd configure that on **1&1** as I've never used them before. But try placing a test `index.html` file with some text in `/` (next to the **laravel** and **www** folders) and access the site to see if that gets served. – Bogdan Feb 05 '15 at 19:42
  • Ah ok no problems. I added a html file with a simple paragraph, which successfully displays when I visit domain.co.uk/index.html specifically. (but not domain.co.uk) – Benji40 Feb 05 '15 at 19:47
  • Please I am having the same problem here can you help a step by step process on how to make that work ? i am using 1&1 Basic server – tony pro May 03 '18 at 00:15

2 Answers2

4

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>
1

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.

Benji40
  • 217
  • 1
  • 5
  • 12