hmm. it didn't like that.
I'm getting the following error:
nginx: [emerg] "server" directive is not allowed here in /config/nginx/nginx.conf:76
I am running this in a docker container, I don't think it would really make a difference. I'm running the linuxserver/piwigo version since I didn't see an "offical" version.
This is my "new" nginx.conf file:
user abc;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
client_max_body_size 0;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /config/log/nginx/access.log;
error_log /config/log/nginx/error.log;
##
# Gzip Settings
##
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/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /config/nginx/site-confs/*;
}
server {
client_max_body_size 500m;
client_body_buffer_size 100m;
location ~ ^/favicon.ico$ {
log_not_found off;
access_log off;
}
location = /robots.txt {
log_not_found off;
access_log off;
}
# Deny Piwigo distribution files
location ~ ^/(README|doc)$ {
deny all;
}
# Deny hidden dot files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Prevent direct access to Piwigo images and logs on filesystem
location ~ ^/(_data/(i|logs)|upload)/ {
return 403;
}
# the @rewrite is required when using
# $conf['question_mark_in_urls'] = false;
# $conf['php_extension_in_urls'] = false;
#
location / {
index index.php;
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite ^/picture((/|$).*)$ /picture.php$1 last;
rewrite ^/index((/|$).*)$ /index.php$1 last;
rewrite ^/i((/|$).*)$ /i.php$1 last;
# for piwigo-openstreetmap
rewrite ^/osmmap((/|$).*)$ /osmmap.php$1 last;
}
location ~ ^(?<script_name>.+?\.php)(?<path_info>/.*)?$ {
try_files $script_name =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
### Prevent hotlinks - this section needs to be _after_ the php handler above
#
# When uploading images via ws.php (e.g. from Lightroom), the are requests from Piwigo
# itself to /i/upload using the servers own IP and "Piwigo" user agent. We need to allow those
###
# Only the site's own URL is a valid referer.
# Empty referers and others like google etc are invalid, see Nginx docs for more info
valid_referers gallery.domain.tld;
# initialize empty variable
set $check_referal "";
# if referer is not our own hostname, set variable's value to "invalid"
if ($invalid_referer) {
set $check_referal "invalid";
}
# if the user agent is not "Piwigo", append "not_piwigo" to the value
if ($http_user_agent !~ "Piwigo") {
set $check_referal "${check_referal}+not_piwigo";
}
# Now, for all images, test if referer is invalid and user agent is not piwigo
# If so, block the request
location ~* \.(gif|png|jpe?g)$ {
if ($check_referal = "invalid+not_piwigo") {
return 403;
}
try_files $uri $uri/ @rewrite;
}
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
daemon off;