El Nino
El Nino

Reputation: 11

Hosting Laravel Application on Ubuntu Server

I have recently developed my first Laravel application (version 5.2.).

I now want to host the application on my client's server running Ubuntu.

Their admin managed to install and run the native Laravel application on the server which works just fine, however when I come to copy and paste my own application over, the browser returns:

403 Forbidden

nginx/1.4.6 (Ubuntu)

Accessing the public folder directly (www.example.com/public/index.php) the browser returns:

The www.example.com page isn’t working

www.example.com is currently unable to handle this request.

HTTP ERROR 500

Can anybody please help me out with the proper method of hosting my application?

Upvotes: 1

Views: 205

Answers (2)

Mauran Muthiah
Mauran Muthiah

Reputation: 1229

Seems more like an nginx-problem. Try to change your nginx virtualhost config to this.

server {
        listen   80;
        server_name yoursite.tld

        root /var/www/yoursite/public/;
        index index.php index.html index.htm;

        location / {
             try_files $uri $uri/ /index.php$is_args$args;
        }

        # pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
        location ~ \.php$ {
                try_files $uri /index.php =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

Upvotes: 2

Sachith Muhandiram
Sachith Muhandiram

Reputation: 2972

First save your file inside,

var/www/html/

Then using Terminal go to your folder
cd var/www/html/your_folder

Run Laravel application

sudo php -S localhost:8888 -t public

Make sure your port number is not same as the other Laravel instance running in the server.

Upvotes: 0

Related Questions