Setting Enviroment Variables for PHP-FPM with Apache

Once in a while you may want to be able to pass information from the apache server to the php-fpm process, a way of doing it is by using environment variables, you can set them either in .htaccess files or in your virtual host configuration files.
 
You can set one variable per line as the following in your file of choice:

SetEnv VARIABLE_NAME "VARIABLE_VALUE"

 
Continue reading “Setting Enviroment Variables for PHP-FPM with Apache”

Force apt-get to use IPv4

If you are having problems with apt and IPv6 a temporary solution is to use the option ‘Acquire::ForceIPv4=true’ by appending ‘-o Acquire::ForceIPv4=true’ at the end of the apt command.

apt-get update -o Acquire::ForceIPv4=true

 
If you want a more permanent solution you can disable the usage of IPv6 with apt altogether with:

echo 'Acquire::ForceIPv4 "true";' | tee /etc/apt/apt.conf.d/99force-ipv4

 

Sources:

https://unix.stackexchange.com/questions/9940/convince-apt-get-not-to-use-ipv6-method

Bad Idea of the day, Disabling VLC root check

Trailing in the deeps of the interwebs, I found an interesting Post, It teaches how to disable the root check for the VLC media player.
 
As some may know VLC rightfully refuses to run as root, and why you would want to run a video player as root is beyond me, but the post explain in some detail how to use a hex editor to search and alter the call to the ‘geteuid()’ function to a call of the ‘getppid()’ function effectively neutering the root check.
 
Continue reading “Bad Idea of the day, Disabling VLC root check”

Enable KSM Centos7/Debian

If you run a lot of Virtual Machines using qemu, you probably can save a lot of memory, at the expense of CPU cycles, by enabling Kernel Samepage Merging (KSM).
 
If you just want to test it and run only on the current boot run the following:

echo 1 > /sys/kernel/mm/ksm/run

 
After testing if you want to enable it permanently you can use systemd temporary files.
Continue reading “Enable KSM Centos7/Debian”

Install python2-certbot-dns-route53 centos 7

If you’ve been bitten by the following bug during the installation of the certbot DNS auth plugin for route53.


---> Package python2-boto3.noarch 0:1.4.6-1.el7 will be installed
--> Processing Dependency: python2-s3transfer >= 0.1.10 for package: python2-boto3-1.4.6-1.el7.noarch
Package python2-s3transfer is obsoleted by python-s3transfer, but obsoleting package does not provide for requirements
--> Finished Dependency Resolution
Error: Package: python2-boto3-1.4.6-1.el7.noarch (epel)
           Requires: python2-s3transfer >= 0.1.10
           Available: python2-s3transfer-0.1.10-1.el7.noarch (epel)
               python2-s3transfer = 0.1.10-1.el7

Continue reading “Install python2-certbot-dns-route53 centos 7”

Enable(fix) write permissions on a NFS share mounted on Windows 10

One annoying “feature” of the windows 10 NFS client is that by default the anonymous user uid and gid is set to -2, and so you can create new files and directories on your NFS server, but you can’t edit or remove existing files.
 
To fix it, you can paste the code bellow in a text file and save it with a ‘.reg’ extension, run it and reboot the machine.
Continue reading “Enable(fix) write permissions on a NFS share mounted on Windows 10”

Apache Reverse Proxy Example

The Simplest reverse proxy configuration possible is the code below, with this configuration your server will proxy all requests from example.com
to subdomain.example.com,

<VirtualHost *:80>
    ServerAdmin [email protected]
    ProxyRequests off
    ServerName example.com
    ProxyPreserveHost On
    <Location />
        ProxyPass http://subdomain.example.com/
        ProxyPassReverse http://subdomain.example.com/
        Order allow,deny
        Allow from all
    </Location>
 
</VirtualHost>

Continue reading “Apache Reverse Proxy Example”