Manual installation with nginx on ubuntu 14.04 lts


#1

Hi Guys,
I installed the latest version of Dreamfactory from github on my ubuntu desktop server 14.04 LTS with an nginx server.
I pointed the root of my nginx server to the public folder of my dreamfactory installation. But here is the thing. If i perform an “artisan serve php” command, i can run my dreamfactory instance but if i run from just localhost i get a blank page. I have checked the dreamfactory.log, nginx error.log, laravel.log and php5-fpm log and there is not any error, its just empty and indicates no evidence of a wrong setup or any mistake. But the confusing part is that if i change the root folder from dreamfactory to any website (default nginx rot or any other html website), if i run localhost, i am able to get any of the websites. Please what can i be doing wrong?

Thanks


#2

check your browser console when loading the page to see any errors that are being generated but not reported to the UI.

Best guess without any further information is that your permissions are incorrect on the storage/ and bootstrap/cache/ directories


#3

Thanks Drew.

I will check. But i did follow the instructions properly and at time even had to give 777 permission to the directory using chmod -R 777 on the storage/ and bootstrap/cache/ directories.

Now, i will check the browser console while browsing to localhost for dreamfactory and report whatever and all i see there as response.

Thanks again


#4

Hi Dreamfactory Team,

I followed Drew’s instruction and checked my browser console and this is the response i have on the browser console.

“Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/ app.ee90cd63.js:3:13186
GET XHR http://localhost/api/v2/system/environment [HTTP/1.1 404 Not Found 0ms]
uncaught exception: [object Object]”

I dont know what this means, please can anyone save my nginx dreamfactory soul??

Thanks


#5

I think this is the key issue. Did you use the example nginx config file on the DreamFactory wiki? It has some configuration that is not included in nginx by default.


#6

Yes;

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /path/to/dreamfactory/public;
index index.php index.html index.htm;

server_name server_domain_name_or_IP;

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

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
    root /usr/share/nginx/html;
}

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

}

Is exactly what my nginx configuration file reads in /etc/nginx/sites-available and its sym linked to /etc/nginx/sites-enabled


#7

If this is exactly what your config file looks like that could be problematic. Here are some potential issues:

default_server can only be assigned to one site (so if you have another one with this directive they will be conflicting.)

root /path/to/dreamfactory/public; need to point to a real path

server_name server_domain_name_or_IP; needs to indicate a real hostname or IP


#8

In exact terms, this is my nginx configuation;

server {

listen 80 default_server;

root /opt/cedf2/public;

. # root /home/cesr15nvm/opt/cedf2/public;

index index.php index.html index.htm;

server_name localhost;

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

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location ~ .php$ {
try_files uri =404; fastcgi_split_path_info ^(.+\.php)(/.+);
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}

}

and its saved as www in my /etc/nginx/sites-available folder. Where /opt/cedf2/public is the path to my dreamfactory installation.


#9

Hi Drew,
I have not heard from you since the last time. Please any update on the situation i complained about the last time. In my previous post i have responded with my actual nginx configuration.

Hope to hear from you soon.


#10

I’m really uncertain regarding this issue, and if anyone else would like to jump in and help troubleshoot I’d welcome it.

Can you do the following?
ls -la /opt/cedf2/
and report back the results.

Additionally, you may want to edit you /opt/cedf2/.env file and change/add
DF_LOG_LEVEL=DEBUG
and
APP_DEBUG=true
and
APP_ENV=local
You’ll need to restart nginx after these changes. You should see a lot more helpful information in the DreamFactory log at this point.


#11

Thanks for your help Drew,

Below are the results of ls -la /opt/cedf2/

While nginx access.log is thus;
127.0.0.1 - - [09/May/2016:16:04:48 +0100] “GET / HTTP/1.1” 302 436 “-” "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0"
127.0.0.1 - - [09/May/2016:16:04:48 +0100] “GET /dreamfactory/dist/index.html HTTP/1.1” 304 0 “-” "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0"
127.0.0.1 - - [09/May/2016:16:04:48 +0100] “GET /dreamfactory/dist/styles/styles.07300592.css HTTP/1.1” 304 0 “http://localhost/dreamfactory/dist/index.html” "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0"
127.0.0.1 - - [09/May/2016:16:04:49 +0100] “GET /dreamfactory/dist/scripts/vendor.8baef916.js HTTP/1.1” 304 0 “http://localhost/dreamfactory/dist/index.html” "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0"
127.0.0.1 - - [09/May/2016:16:04:49 +0100] “GET /dreamfactory/dist/vendor/ace/mode-javascript.js HTTP/1.1” 304 0 “http://localhost/dreamfactory/dist/index.html” "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0"
127.0.0.1 - - [09/May/2016:16:04:49 +0100] “GET /dreamfactory/dist/vendor/ace/ace.js HTTP/1.1” 304 0 “http://localhost/dreamfactory/dist/index.html” "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0"
127.0.0.1 - - [09/May/2016:16:04:49 +0100] “GET /dreamfactory/dist/scripts/app.ee90cd63.js HTTP/1.1” 304 0 “http://localhost/dreamfactory/dist/index.html” "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0"
127.0.0.1 - - [09/May/2016:16:05:29 +0100] “GET /api/v2/system/environment HTTP/1.1” 404 162 “http://localhost/dreamfactory/dist/index.html” "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0"
127.0.0.1 - - [09/May/2016:16:05:29 +0100] “GET /favicon.ico HTTP/1.1” 200 6214 “-” “Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0”

Browse web console still shows;

I shall appreciate input from other administratrs or any one who has had a similar issue before.

Thanks.


#12

I have deleted installation and tried other directories, imported again from github repositories, its just the same all over. Do i reformat the system?

Thanks


#13

Hi Drew,

May I know if there is any update on the issues I have raised so far with nginx github installation. I will be grateful if

you can be kind enough to offer hints of solutions based on my 2 previous posts as response of your suggestions.

I have also gone ahead to change the group owner of the /opt/cedf2/storage/ and /opt/cedf2/bootstrap/cache/ folders using

chgrp -R www-data /storage/ /bootstrap/cache/ and even eventually did a total ownership of the /opt/cedf2/ folder to www-

data using chown -R www-data:www-data /opt/cedf2/

Please bail me out.

As you right pointed out before, this is the main challenge;

“GET XHR http://localhost/api/v2/system/environment1 [HTTP/1.1 404 Not Found 0ms]
uncaught exception: [object Object]”"

even after so many trials and tweaks.


#14

LEMP stack Ubuntu 14.04

I get the same thing on a new install of a DO droplet ubuntu 14.04 and a manual vanilla install of LEMP

Have permissions set to 777 on all folders and files

Browser Error Chrome

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
http://lempdreamfactory.myserver.org/myserver/dist/scripts/app.a66ba06d.js Failed to load resource: the server responded with a status of 404 (Not Found)b @ app.a66ba06d.js:3
app.a66ba06d.js:3 Uncaught

Nginx default config

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /home/mydir/dreamfactory/public;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name lempdreamfactory.myserver.org;

    gzip on;
    gzip_disable "msie6";

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/java$

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
      root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

}

Also the index.php page gets redirected to
http://lempdreamfactory.myserver.org/dreamfactory/dist/index.html

Thanks


#15

Hi,

Sorry i have not gotten back on the status of my challenge on this thread. I have since re-installed DF on 2 different Ubuntu server setups in the last 1 week. And i also had to re-install ubuntu again on the server i used to have the problem.

But here a few lessons,

  1. i am certain the version of DF at that time v2.0.1 had a lot to do with the issues around configuration with nginx.
  2. it would be very safe to purge apache2 completely from the server in order to make it work. Although i am not sure but i think that saved me when re-installing the servers that worked.
  3. ensure that mongodb’s installation had no errors (whatsoever) during its installation. And make wure you follow the dreamfactory wiki page on mongodb installation using the correct instruction for the correct version of DF http://wiki.dreamfactory.com/DreamFactory/Installation/Databases/MongoDB.

@delebash, are you sure this entry “gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/java$” in your nginx configuration is correct? I doubt its correct if its the way its quoted from your configuration file.
Also, try do remove the DF and use nginx default landing page (html page) as root. If that works, then

  1. goind forward it would be advisable to run all your nginx setup, DF setup and all other dependencies as root.
  2. i will implore you to alo use /var/www/ or /opt/ (especially /var/www/) as your installation directories instead of your home directory.

I hope this summary helps.

All the best.


#16

@ventis

Thanks for the catch on the gzip it was a copy from the nginx config on dreamfactories website but the copy must have messed up

I don’t have apache installed this is a new Lemp stack
I am not installing mongo-db aws rackspace so I removed them from the composer config

I Installed the latest dreamfactory from git using the git command listed on dreamfactories wiki site

I originally used /opt. I just used the user directory on this last attempt to see if it made a difference.

Also I originally added this to my VestaCP(just a web control panel with default Lemp stack) Nginx was installed and already had php-fpm configured correctly.

However the last two attempts were on a clean Lemp build non VestaCP

I am trying a new Lemp stack with corrected gzip and /opt directory and will let you know.

Thank you for your help and quick response


#17

Thanks for you help it’s working now :slight_smile:


#18

Am glad i was of help. All the best.