How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

January 30, 2020

pdftk ubuntu 18

Filed under: Linux — Tags: , — admin @ 6:22 pm

Today I have tried to install pdftk on ubuntu 18 . After search on developer site I saw that are package only for the redhat/centos.

So after a few search find out that you can install it with snap install pdftk

However this will not work .

Error: Unable to find file.
Error: Failed to open PDF file:
Errors encountered. No output created.
Done. Input errors, so no output created.

Errors like this you will see.

One solution is to download and install from other links

cd /tmp
# download packages
wget http://launchpadlibrarian.net/340410966/libgcj17_6.4.0-8ubuntu1_amd64.deb \
 http://launchpadlibrarian.net/337429932/libgcj-common_6.4-3ubuntu1_all.deb \
 https://launchpad.net/ubuntu/+source/pdftk/2.02-4build1/+build/10581759/+files/pdftk_2.02-4build1_amd64.deb \
 https://launchpad.net/ubuntu/+source/pdftk/2.02-4build1/+build/10581759/+files/pdftk-dbg_2.02-4build1_amd64.deb

And after that you can install them with 
sudo apt-get install ./libgcj17_6.4.0-8ubuntu1_amd64.deb \
    ./libgcj-common_6.4-3ubuntu1_all.deb \
    ./pdftk_2.02-4build1_amd64.deb \
    ./pdftk-dbg_2.02-4build1_amd64.deb

After that you can remove those from /tmp directory

How to Install PHP-FPM with Apache on Ubuntu 18.04

Filed under: Linux — Tags: , — admin @ 3:33 pm

Common module for php are

apt install php7.1-fpm php7.1-common php7.1-mysql php7.1-xml php7.1-xmlrpc php7.1-curl php7.1-gd php7.1-imagick php7.1-cli php7.1-dev php7.1-imap php7.1-mbstring php7.1-soap php7.1-zip php7.1-bcmath -y

To install apache

apt install apache2

Enable mod proxy

sudo a2enmod proxy_fcgi

A virtual host example

<VirtualHost *:80>
     ServerName External_IP_Address
     DocumentRoot /var/www/html

     <Directory /var/www/html>
          Options Indexes FollowSymLinks
         AllowOverride All
         Require all granted
     </Directory>

     <FilesMatch ".php$"> 
         SetHandler "proxy:unix:/var/run/php/php7.1-fpm.sock|fcgi://localhost/"          
      </FilesMatch>
 
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined  
</VirtualHost> 

February 5, 2019

How to exclude subfolder from password protection with .htaccess

Filed under: Linux — Tags: , , , , , — admin @ 1:38 pm

So if you want to protect a website with .htaccess and .htpasswd basically you will use

AuthType Basic
AuthName “Password Protected Area”
AuthUserFile /path/.htpasswd
Require valid-user

If you want a subdirectory to be excluded from auth like .well-known , for lets encrypt then a easy way it to create a .htaccess on .well-known directory and place in it

Satisfy any

Other version is to insert into vhosts

<Location /.well-known>
    Require all granted
</Location>

Another one is to add

SetEnvIf Request_URI “path/to/excluded/directory/” allow
SetEnvIf Request_URI “path/to/excluded/file” allow
Order allow,deny
Allow from env=allow
Satisfy any

And anothe one is to add

Require expr %{REQUEST_URI} =~ m#^/.well-known/acme-challenge/#

Before require valid user

January 24, 2019

Ubuntu rc-local

Filed under: Linux — Tags: , — admin @ 11:55 am

On a ubuntu 18 I try to reboot a service after it start so I was try to use rc.local but this is no longer there .

So you create this file

/etc/systemd/system/rc-local.service

You add into it this

[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

Then make the file chmod +x /etc/rc.local

and add

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0

Final step is to enable the service

systemctl enable rc-local

December 10, 2018

Your browser sent a request that this server could not understand

Filed under: Linux — Tags: , , , — admin @ 4:51 pm

Well today I am facing another problem.

Got this answer on a apache behind a proxy .

400 Bad Request
Bad Request
Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit.

So .. it appear the header that is received by webserver is bigger then normal .

Solution is to increase it .

LimitRequestFieldSize 32760
LimitRequestLine 32760

Please note that is loaded from first VirtualHost.

One solution is to tested with this

curl -v -H “CustomHeader: `printf ‘1%.0s’ {1..n}`” localhost

Where n can be replace with a value of for example 20000

 

« Newer PostsOlder Posts »

Powered by WordPress