You are not logged in.
Hello guys,
I am currently trying to get nginx to serve Grocy.
I already found a guide on how to do this on Debian 11.
debian 11 lxc (working) - source: https://github.com/grocy/grocy/issues/649#issuecomment-740212211)
=======================
01. apt update && apt full-upgrade -y && reboot
02. apt install -y nginx sqlite3 php-fpm php-sqlite3 php-gd unzip
03. wget https://releases.grocy.info/latest
04. unzip latest -d /var/www/html && rm latest
05. chown -R www-data:www-data /var/www
06. cp /var/www/html/config-dist.php /var/www/html/data/config.php
07. check php version for step 7 and 8
ls /var/run/php/
08. nano /etc/nginx/conf.d/fastcgi_params
include fastcgi_params;
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
09. nano /etc/nginx/sites-available/default
server {
listen 80 default_server;
root /var/www/html/public;
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
try_files $uri /index.php;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
10. systemctl restart nginx
Now I would like to do the same on Arch Linux.
I think the only issue is the path for "fastcgi_pass" in step 7 and 8.
I know that my command above will install php8. The folder structure is different than in version 7.x.
I already tried some other paths for "fastcgi_pass"but none of them worked.
arch linux lxc (not working)
==============
01. pacman -Syu && reboot
02. pacman -S nginx sqlite php-fpm php-sqlite php-gd unzip
03. curl https://releases.grocy.info/latest -o latest
04. unzip latest -d /var/lib/grocy && rm latest
05. chown -R http:http /var/lib/grocy
06. cp /var/lib/grocy/config-dist.php /var/lib/grocy/data/config.php
07. nano /etc/nginx/conf.d/fastcgi_params
include fastcgi_params;
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # I assume this line is making trouble
08. nano /etc/nginx/sites-available/default
server {
listen 80 default_server;
root /var/www/html/public;
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
try_files $uri /index.php;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # I assume this line is making trouble
}
}
09. systemctl restart nginx php-fpm
Can somebody guide me in the right direction or help me adopt the debian guides config files to php8 on Arch Linux?
Grocy supports php8.
Kind Regards
TheHellSite
Last edited by TheHellSite (2022-05-31 08:18:05)
Offline
Offline
Thanks. I already checked the docs but just couldn't figure it out...
However after several hours today I finally managed to get it up and running.
Is there anything I could improve in the guide below?
arch linux lxc
==============
01. pacman -Syu && reboot
02. pacman -Syu nginx php-fpm php-gd php-intl php-sqlite sqlite unzip wget
03. systemctl enable --now nginx php-fpm
04. nano /etc/php/php.ini
# uncomment the necessary php extensions for grocy...
;extension=gd
;extension=iconv
;extension=intl
;extension=pdo_sqlite
;extension=sqlite3
05. nano /etc/nginx/nginx.conf
replace...
include mime.types;
with...
include mime.types;
include sites-available/*;
and... replace...
keepalive_timeout 65;
with...
keepalive_timeout 65;
types_hash_max_size 4096;
06. wget https://releases.grocy.info/latest
07. unzip latest -d /var/lib/grocy && rm latest
08. cp /var/lib/grocy/config-dist.php /var/lib/grocy/data/config.php
09. chown -R http:http /var/lib/grocy
10. mkdir /etc/nginx/ssl
11. openssl req -x509 -newkey rsa:4096 -sha512 -days 36500 -nodes -subj "/" -keyout /etc/nginx/ssl/key.pem -out /etc/nginx/ssl/cert.pem &> /dev/null
12. mkdir /etc/nginx/sites-available
13. nano /etc/nginx/sites-available/grocy.conf
# HTTP server (redirects to HTTPS)
server {
listen 80;
server_name _;
return 301 https://$host$request_uri;
}
# HTTPS server
server {
listen 443 ssl http2;
server_name _;
ssl_protocols TLSv1.3;
ssl_certificate ssl/cert.pem;
ssl_certificate_key ssl/key.pem;
root /var/lib/grocy/public;
location / {
try_files $uri /index.php;
}
location ~ \.php$ {
# 404
try_files $fastcgi_script_name =404;
# default fastcgi_params
include fastcgi_params;
# fastcgi settings
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_index index.php;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
# fastcgi params
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
}
13. systemctl restart nginx php-fpm
14. visit https://local_ip
Last edited by TheHellSite (2022-05-31 23:41:39)
Offline