LycheeOrg / Lychee

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
3.42k stars 303 forks source link

Server Error or API not found. #736

Closed syamajala closed 4 years ago

syamajala commented 4 years ago

Detailed description of the problem [REQUIRED]

I'm trying to setup lychee. Whenever I try to access the server I get a dark screen with server error or api not found at the top. In my nginx log I see this: FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream,

I'm not sure if I setup nginx correctly. Here is my nginx config:

    server {
        server_name photo.brokensymlink.net;
        root /share/lychee/public;
        index index.php index.html;

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

        location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff)\$ {
                access_log off;
                expires 30d;
                add_header Pragma public;
                add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
        }

        location ~ \.php$ {
                fastcgi_split_path_info ^(.*\.php)(/.*)?$;
                # default fastcgi_params
                include fastcgi_params;

                # fastcgi settings
                fastcgi_pass                    unix:/run/php-fpm/php-fpm.sock;
                fastcgi_index                   index.php;
                fastcgi_buffers                 8 16k;
                fastcgi_buffer_size             32k;
                fastcgi_intercept_errors        off;

                # fastcgi params
                fastcgi_param DOCUMENT_ROOT     $realpath_root;
                fastcgi_param SCRIPT_FILENAME   $realpath_root$fastcgi_script_name;
                #fastcgi_param PHP_ADMIN_VALUE  "open_basedir=$base/:/usr/lib/php/:/tmp/";
        }

        location ~ /\.ht {
                deny all;
        }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/photo.brokensymlink.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/photo.brokensymlink.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

Steps to reproduce the issue

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error*

Output of the diagnostics [REQUIRED]

(Settings => Diagnostics or https://example.com/Diagnostics or php artisan lychee:diagnostics)

Diagnostics
-----------
Error: username empty or not set in database
Error: password empty or not set in database
Warning: Dropbox import not working. dropbox_key is empty.
Warning: You may experience problems when uploading a large amount of photos. Take a look in the FAQ for details.

System Information
------------------
Lychee Version (release):   4.0.6
DB Version:                 4.0.6

composer install:           --no-dev
APP_ENV:                    production
APP_DEBUG:                  false

System:                     Linux
PHP Version:                7.4
MySQL Version:              10.5.5-MariaDB

Imagick:                    1
Imagick Active:             1
Imagick Version:            1802
GD Version:                 2.3.0

Config Information
------------------
version:                    040006
check_for_updates:          0
sorting_Photos_col:         takestamp
sorting_Photos_order:       ASC
sorting_Albums_col:         max_takestamp
sorting_Albums_order:       ASC
imagick:                    1
skip_duplicates:            0
small_max_width:            0
small_max_height:           360
medium_max_width:           1920
medium_max_height:          1080
lang:                       en
layout:                     1
image_overlay:              1
image_overlay_type:         desc
default_license:            none
compression_quality:        90
full_photo:                 1
delete_imported:            0
Mod_Frame:                  1
Mod_Frame_refresh:          30
thumb_2x:                   1
small_2x:                   1
medium_2x:                  1
landing_page_enable:        0
landing_owner:              John Smith
landing_title:              John Smith
landing_subtitle:           Cats, Dogs & Humans Photography
landing_facebook:           https://www.facebook.com/JohnSmith
landing_flickr:             https://www.flickr.com/JohnSmith
landing_twitter:            https://www.twitter.com/JohnSmith
landing_instagram:          https://instagram.com/JohnSmith
landing_youtube:            https://www.youtube.com/JohnSmith
landing_background:         dist/cat.jpg
site_title:                 Lychee v4
site_copyright_enable:      1
site_copyright_begin:       2019
site_copyright_end:         2019
additional_footer_text:     
display_social_in_gallery:  0
public_search:              0
SL_enable:                  0
SL_for_admin:               0
public_recent:              0
recent_age:                 1
public_starred:             0
downloadable:               0
photos_wraparound:          1
map_display:                0
zip64:                      1
map_display_public:         0
map_provider:               Wikimedia
force_32bit_ids:            0
map_include_subalbums:      0
update_check_every_days:    3
has_exiftool:               0
share_button_visible:       0
import_via_symlink:         0
has_ffmpeg:                 1
location_decoding:          0
location_decoding_timeout:  30
location_show:              1
location_show_public:       0
rss_enable:                 0
rss_recent_days:            7
rss_max_items:              100
prefer_available_xmp_metadata: 0

Browser and system

Chromium

r7l commented 4 years ago

I am sitting in the same boat after updating from 3.x to 4. The config you've posted works for version 3 but stopped working for version 4.

There is no /php/index.php file or php directory in general. Can anyone provide a working Nginx configuration for version 4?

d7415 commented 4 years ago

Try this one. The rewrites should fix it - it might be possible to handle that with try_files but I don't have time to investigate that right now.

Sorry it's taken so long for a reply.

syamajala commented 4 years ago

works for me.

r7l commented 4 years ago

Thanks, works for me as well