Search…

X3 Photo Gallery Support Forums

Search…
 
AlexKalopsia
Topic Author
Posts: 13
Joined: 20 Apr 2022, 06:05

Can't figure out nginx upload values

20 Oct 2023, 15:14

I am running X3 Gallery, and I have it in a directory on my server. It runs well, and I reach it from subdomain.mydomain.com using a reverse proxy setup.

I am just struggling with the upload size: even if I set the correct upload value via the nginx config, X3 seemingly ignores it.
Code
server {

  listen 443 ssl http2;
  listen [::]:443 ssl http2;

  server_name x.x.com;

  root /config/www/x.com/photo;

  index index.php;

  include /config/nginx/ssl.conf;

  client_max_body_size 0;

  # X3 rewrite rules
  location / {
    if (!-e $request_filename){

      # Rewrite any calls to html|json|xml|atom|rss if a folder matching * exists
      rewrite (.+)\.(html|json|xml|atom|rss)$ $1/ last;

      # Rewrite any calls to /render to the X3 image resizer
      rewrite ^/render/. /app/parsers/slir/ last;

      # Rewrite routes to X3 application index.php if they are non-existent files/dirs
      rewrite ^(.*)$ /index.php?$1 last;
    }
  }

  # Prevent web access to X3 /config and /_cache directories
  location ~ /(config|_cache) {
    deny all;
  }

  # PHP [OPTIONAL]
  location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass 127.0.0.1:9000;

    # 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;

  }
}
Image

Any idea what could be overwriting this?
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: Can't figure out nginx upload values

20 Oct 2023, 23:54

I can't quite understand what your PHP upload_max_filesize has to do with your NGINX config. Normally, upload_max_filesize needs to be assigned from your php.ini file. Nginx client_max_body_size is something strictly related to Nginx, but it won't automatically unlock your PHP upload_max_filesize, which is set to 2MB.

This needs to be assigned from your php.ini configuration file.
 
AlexKalopsia
Topic Author
Posts: 13
Joined: 20 Apr 2022, 06:05

Re: Can't figure out nginx upload values

21 Oct 2023, 04:26

If I nginx -v on my server, I get nginx/1.20.1
I have X3 Gallery somewhere in a folder volume1/docker/swag/www/x3gallery
I use swag to setup my website routing. If I bash into swag and nginx -v, I get nginx/1.24.0 (this is in line with what X3 diagnostics say)
I have a CNAME record (cloudflare DNS Only) for a subdomain gallery.mydomain.com, which points correctly to the folder. The website can be reached with no issues.

X3 diagnostics also says that I have a max upload size of 2M and post max size of 8M. I am trying to understand how that is possible.

This my nginx config for x3: https://hastebin.com/share/ekecifaren.perl

my swag php-local.ini (which overrides php.ini) shows


Code
date.timezone = Europe/Stockholm
display_errors = On
log_errors = On

memory_limit 512M
upload_max_filesize 512M
post_max_size 512M
max_input_vars = 2000
max_execution_time = 0

In the X3 sub folder, as well as in the parent folder, I have .htaccess with

Code
php_value upload_max_filesize 200M
php_value post_max_size 200M

I have absolutely no idea how this is possible and I am running out of ideas. I also did a grep in the nas etc/nginx folder, and I see nothing setting 2M and  8M. Also did a grep in the swap folder, same result.
 
AlexKalopsia
Topic Author
Posts: 13
Joined: 20 Apr 2022, 06:05

Re: Can't figure out nginx upload values

21 Oct 2023, 05:07

And, as a follow-up question - is there a way to debug where - on my machine - X3 is getting the php info from?
 
AlexKalopsia
Topic Author
Posts: 13
Joined: 20 Apr 2022, 06:05

Re: Can't figure out nginx upload values

21 Oct 2023, 05:29

Ok, found the issue. I had a syntax error in my php-local.ini file.

I had
Code
upload_max_filesize 512M
post_max_size 512M
while it should have been
Code
upload_max_filesize = 512M
post_max_size = 512M
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13998
Joined: 30 Sep 2006, 03:37

Re: Can't figure out nginx upload values

21 Oct 2023, 08:56

Glad it's solved.
AlexKalopsia wrote: And, as a follow-up question - is there a way to debug where - on my machine - X3 is getting the php info from?
If you go to Panel > Tools > PHPinfo, you can view your php info, including what PHP config files are used. This is the same as output as including the following in a phpinfo.php file:
Code
<?php phpinfo();