flarum / framework

Simple forum software for building great communities.
http://flarum.org/
6.35k stars 834 forks source link

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

Closed jhnferraris closed 9 years ago

jhnferraris commented 9 years ago

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 commented 9 years ago

Try adding the following line above the first location block:

index index.html index.htm index.php;
jhnferraris commented 9 years ago

@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 commented 9 years ago

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

jhnferraris commented 9 years ago

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

tobyzerner commented 9 years ago

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 commented 8 years ago

@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 commented 8 years ago

@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 commented 8 years ago

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

nicodemuz commented 8 years ago

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 commented 8 years ago

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

younes0 commented 8 years ago

@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.