sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt install php7.2-fpm php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-cli php7.2-curl php7.2-zip
sudo nano /etc/php/7.2/fpm/php.ini
file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 10M
cgi.fix_pathinfo = 0
max_execution_time = 360
date.timezone = Europe/Prague
###instal php on nging https://hostup.org/blog/how-to-install-nginx-and-php-8-on-debian-10/
#sudo apt install php8.0-fpm php8.0-common php8.0-mysql php8.0-gmp php8.0-curl php8.0-intl php8.0-mbstring php8.0-xmlrpc php8.0-gd php8.0-xml php8.0-cli php8.0-zip php8.0-soap #php8.0-imap php-zip-y
#sudo nano /etc/php/8.0/fpm/php.ini
file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 10M
cgi.fix_pathinfo = 0
max_execution_time = 360
date.timezone = Europe/Prague
###### install getsimple
cd /tmp && wget http://get-simple.info/latest
sudo -i
sudo mkdir /var/www/html/getsimple
sudo unzip latest -d /var/www/html/
sudo mv /var/www/html/Get.../* /var/www/html/getsimple
sudo rm /var/www/html/Get... -r
sudo chown -R www-data:www-data /var/www/html/getsimple
sudo chmod -R 755 /var/www/html/getsimple
sudo nano /etc/nginx/sites-available/getsimple
###############
## define here or in /etc/nginx/nginx.conf if you have multiple sites sharing the same cache
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=GETSIMPLE:10m inactive=15m;
##
map $http_cookie $logged_in {
default 0;
~GS_ADMIN_USERNAME 1; # This will return true if user is logged in
}
server {
listen 80;
listen [::]:80;
server_name getsimple.raiv.cc;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name getsimple.raiv.cc;
ssl_certificate /etc/letsencrypt/live/getsimple.raiv.cc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/getsimple.raiv.cc/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSV1.1 TLSV1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
root /var/www/html/getsimple;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?id=$uri&$args;
fastcgi_cache_bypass $logged_in;
fastcgi_no_cache $logged_in;
}
location ~* /admin/.*\.php$ {
try_files $uri /admin/index.php?id=$uri&$args;
include /etc/nginx/fastcgi_params;
fastcgi_cache_bypass $logged_in;
fastcgi_no_cache $logged_in;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
}
location ~* \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
try_files $uri =404;
fastcgi_cache_bypass $logged_in;
fastcgi_no_cache $logged_in;
ffastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_cache GETSIMPLE;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_valid 200 302 10s;
fastcgi_cache_valid 404 2m;
expires 2h;
}
location ~* \.(?:ico|js|gif|jpg|png)$ {
expires 14d;
}
location ~* \.(htm|css|html)$ {
expires 2d;
}
# this blocks direct access to the XML files (but sitemap.xml) - that hold all >
location ~* \.xml$ { deny all; }
location ~* \.xml\.bak$ { deny all; }
location = /sitemap.xml { allow all; }
# this prevents hidden files (beginning with a period) from being served
location ~ /\. { deny all; }
location ^~ /uploads/ {
if ($request_uri ~* \.php$) {return 403;}
}
}
################# !!!! NOOO
server {
listen 80;
listen [::]:80;
server_name getsimple.raiv.cc;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name getsimple.raiv.cc;
ssl_certificate /etc/letsencrypt/live/getsimple.raiv.cc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/getsimple.raiv.cc/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSV1.1 TLSV1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
root /var/www/html/getsimple;
index index.php index.html index.htm;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?id=$uri&$args;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
location /admin/ {
try_files $uri /admin/index.php?id=$uri&$args;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# Apply the subdirectory base path to PHP script
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
}
!!!!!!!!!!!!!!!! testing only
server {
listen 9980;
server_name 192.168.100.250;
root /var/www/html/getsimple;
index index.php index.html index.htm;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?id=$uri&$args;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
location /admin/ {
try_files $uri /admin/index.php?id=$uri&$args;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# Apply the subdirectory base path to PHP script
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
}
sudo ln -s /etc/nginx/sites-available/getsimple /etc/nginx/sites-enabled/
sudo nano /etc/php/8.0/fpm/php.ini
#ad on the end:
memory_limit = 32M
upload_max_filesize = 5M
post_max_size = 3M
sudo nano /etc/nginx/nginx.conf
#add to section: http {
client_max_body_size 5M;
sudo service php8.0-fpm restart
sudo systemctl restart nginx.service