Project

General

Profile

Support #970

Updated by Daniel Curtis about 2 years ago

This is a guide for installing Grocy with Nginx on Arch Linux. 

 h2. Prepare the Environment 

 * Make sure the system is up to date: 
 <pre> 
 sudo pacman -Syu 
 </pre> 

 * Install a few dependencies: 
 <pre> 
 sudo pacman -S git 
 </pre> 

 * Add a grocy user: 
 <pre> 
 sudo useradd -m -g users -s /bin/bash ind3x 
 </pre> 

 h2. Install PHP 

 * Install php and additional required packages: 
 <pre> 
 sudo pacman -S php php-fpm php-sqlite php-gd php-intl composer yarn 
 </pre> 

 * Edit the php config: 
 <pre> 
 sudo nano /etc/php/php.ini 
 </pre> 
 #* And enable the following extensions: 
 <pre> 
 extension=gd 
 extension=intl 
 extension=sqlite3 
 extension=pdo_sqlite 
 extension=iconv 
 </pre> 

 * Start and enable php-fpm at boot: 
 <pre> 
 sudo systemctl enable php-fpm 
 sudo systemctl start php-fpm 
 </pre> 

 h2. Install Grocy 

 * Download grocy and switch to grocy user: 
 <pre> 
 sudo mkdir -p /var/www && cd /var/www 
 sudo git clone -b release https://github.com/grocy/grocy.git 
 chown -R grocy /var/www/grocy 
 sudo su - grocy 
 </pre> 

 * Install grocy: 
 <pre> 
 cd /var/www/grocy 
 composer install --no-interaction --no-dev --optimize-autoloader 
 composer clear-cache 
 yarn install --modules-folder public/node_modules --production 
 yarn cache clean 
 </pre> 

 * Create a new config file: 
 <pre> 
 cp config-dist.php data/config.php 
 </pre> 

 * Exit the grocy user: 
 <pre> 
 exit 
 </pre> 

 h2. Install Nginx 

 * Install Nginx nginx 
 <pre> 
 sudo pacman -S nginx 
 </pre> 

 * Start and enable nginx at boot: 
 <pre> 
 systemctl enable nginx 
 systemctl start nginx 
 </pre> 

 * Create a configuration directory to make managing individual server blocks easier 
 <pre> 
 mkdir /etc/nginx/conf.d 
 </pre> 

 * Edit the main nginx config file: 
 <pre> 
 sudo nano /etc/nginx/nginx.conf 
 </pre> 
 #* And strip down the config file and add the include statement at the end: 
 <pre> 
 worker_processes    1; 
 error_log    /var/log/nginx-error.log; 

 events { 
     worker_connections    1024; 
 } 

 http { 
     include         mime.types; 
     default_type    application/octet-stream; 
     sendfile          on; 
     keepalive_timeout    65; 

     include /etc/nginx/conf.d/*.conf; 
 } 
 </pre> 

 * Create the grocy config: 
 <pre> 
 sudo nano /etc/nginx/conf.d/grocy.conf 
 </pre> 
 #* And add the following: 
 <pre> 
 server { 
     listen         80; 
     server_name    grocy.example.com; 
     root           /var/www/grocy/public; 
     access_log     /var/log/grocy-access.log; 
     error_log      /var/log/grocy-error.log; 

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

     location ~ \.php$ { 
         fastcgi_pass unix:/run/php-fpm/php-fpm.sock; 
         fastcgi_param SCRIPT_FILENAME /var/www/grocy/public$fastcgi_script_name; 
         fastcgi_param PATH_INFO $fastcgi_script_name; 
         include fastcgi_params; 
     } 
 } 
 </pre> 

 * Restart nginx: 
 <pre> 
 systemctl restart nginx 
 </pre> 

 h2. Resources 

 * https://github.com/grocy/grocy 
 * https://github.com/grocy/grocy/issues/201 
 * https://aur.archlinux.org/packages/grocy

Back