Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post installation problems. "Cannot GET http://dev.hostname.com" #359

Closed
jhnferraris opened this issue Aug 30, 2015 · 11 comments
Closed

Post installation problems. "Cannot GET http://dev.hostname.com" #359

jhnferraris opened this issue Aug 30, 2015 · 11 comments

Comments

@jhnferraris
Copy link

I installed Flarum in my local machine using the CLI as instructed here. http://flarum.org/docs/installation/

I have my nginx config here:

server{
    listen 80;
    server_name dev.hostname.com;

    root /path/to/flarum;

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

    location /api {
        try_files $uri $uri/ /api.php?$query_string;
    }

    location /admin {
        try_files $uri $uri/ /admin.php?$query_string;
    }

    location /flarum {
        deny all;
        return 404;
    }

    location ~ .php$ {
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include /usr/local/etc/nginx/fastcgi.conf;
    }
}

I have also set my /etc/hosts

127.0.0.1 dev.hostname.com

I have successfully run flarum/flarum install

But when I ran dev.hostname.com in my web browser. It returned "Cannot GET http://dev.hostname.com"

Currently, I've tried chmod on the project folder with 777 (this includes flarum/storage) but no progress so far.

What am I missing here?

@tobyzerner
Copy link
Contributor

Try adding the following line above the first location block:

index index.html index.htm index.php;

@jhnferraris
Copy link
Author

@tobscure Like so?

....
index index.html index.htm index.php;
location / {
    try_files $uri $uri/ /index.php?$query_string;
 }

 location /api {
    try_files $uri $uri/ /api.php?$query_string;
 }
 ...

Still the same output. A white page with "Cannot GET http://dev.hostname.com"

@tobyzerner
Copy link
Contributor

Hmm, can you check your nginx logs and see if you can find an error message with more info?

@jhnferraris
Copy link
Author

@tobscure Sadly nothing interesting in my nginx logs that's why I'm escalating this to you guys. hehe

@tobyzerner
Copy link
Contributor

I don't think this is an issue with Flarum so I'm closing this. I'm afraid without more information, I don't know what else to try. @franzliedke any ideas? Maybe try increasing the verbosity of the nginx logs?

@nicodemuz
Copy link

@tobscure I'm also experiencing the same issue.

I added a die() statement in the top of the index.php file, just to see if it hits the file or not, and sure enough it did. If I further edit the index.php to emit some headers, I see the following error:

Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to emit response; headers already sent' in /testing/flarum/vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php:31 Stack trace: #0 /testing/flarum/vendor/zendframework/zend-diactoros/src/Server.php(170): Zend\Diactoros\Response\SapiEmitter->emit(Object(Zend\Stratigility\Http\Response), 2) #1 /testing/flarum/vendor/flarum/core/src/Http/AbstractServer.php(33): Zend\Diactoros\Server->listen() #2 /testing/flarum/index.php(16): Flarum\Http\AbstractServer->listen() #3 {main} thrown in /testing/flarum/vendor/zendframework/zend-diactoros/src/Response/SapiEmitter.php on line 31

@nicodemuz
Copy link

@tobscure Accessing directly /index.php instead of just the root /, seems to give some output. However, the assets do not load when accessing thru /index.php, gives a 404 for:
/index.php/assets/forum-3809febf.css

@jhnferraris
Copy link
Author

@MrNicodemuz Can you show your nginx config, so I can try to replicate. :)

@nicodemuz
Copy link

Hi @jhnferraris,

Sure, see my nginx config below:

server {

    error_log /var/log/nginx/discussions-platform/error.log;
    access_log /var/log/nginx/discussions-platform/access.log;

    set $discussions_platform_root "/Users/Admin/Projects/discussions-platform/flarum";
    set $discussions_platform_fastcgi "127.0.0.1:9000";

    listen 80;

    server_name
        discussions.com
    ;

    root $discussions_platform_root;
    index index.php;

    location / { try_files $uri $uri/ /index.php?$query_string; }
    location /api { try_files $uri $uri/ /api.php?$query_string; }
    location /admin { try_files $uri $uri/ /admin.php?$query_string; }

    location /flarum {
        deny all;
        return 404;
    }

    location ~ .php$ {
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass $discussions_platform_fastcgi;
        fastcgi_param SCRIPT_FILENAME $discussions_platform_root$fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~* \.html$ {
        expires -1;
    }

    location ~* \.(css|js|gif|jpe?g|png)$ {
        expires 1M;
        add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }

    gzip on;
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_proxied any;
    gzip_types application/atom+xml
               application/javascript
               application/json
               application/vnd.ms-fontobject
               application/x-font-ttf
               application/x-web-app-manifest+json
               application/xhtml+xml
               application/xml
               font/opentype
               image/svg+xml
               image/x-icon
               text/css
               text/plain
               text/xml;
    gzip_buffers 16 8k;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

}

@nicodemuz
Copy link

Hi @jhnferraris, were you able to replicate the problem?

@younes0
Copy link

younes0 commented Jul 1, 2016

@jhnferraris make sure that the url in \config.php does not end with index.
This erroneous url may been set with a bad nginx configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants