OpenBSD: phpMyAdmin and NGINX

We will suppose MySQL is already installed.

# pkg_add php-fpm php-mysql phpmyadmin

 In /etc/rc.conf.local:

pkg_scripts="mysqld php_fpm"
 # cp -fR /var/www/phpMyAdmin to /var/www/htdocs

Add to /etc/nginx/nginx.conf:

location / {
     root   /htdocs;
     index  index.html index.htm index.php;
location ~ \.php$ {
     try_files      $uri $uri/ =404;
     fastcgi_pass   unix:run/php-fpm.sock;
     fastcgi_index  index.php;
     fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include        fastcgi_params;
location /phpmyadmin/ {
     root   /htdocs;
     index  index.html index.htm index.php;
location ~ ^/phpmyadmin/\.php$ {
     try_files      $uri $uri/ =404;
     fastcgi_pass   unix:run/php-fpm.sock;
     fastcgi_index  index.php;
     fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include        fastcgi_params;

Make a file ‘/var/www/htdocs/phpinfo.php with the following lines:

php phpinfo();

Start nginx and php_fpm:

/etc/rc.d/php_fpm start
/etc/rc.d nginx start

Test the PHP installation with your browser pointing to ‘localhost/phpinfo.php’. If a page with information about your PHP installation then nginx is executing php code. If what you see is php code then nginx is serving PHP pages as plain text (review your nginx configuration).


If nginx is executing PHP code then you can try phpMyAdmin, pointing your browser to:



A good article as reference:

Posted in BSD, OpenBSD | Leave a comment

OpenBSD: connection problems with some sites in internet

I’m experiencing some problems when trying to connect, via web browser, with some sites as ebay or google. I’ve discovered that I get a better experience browsing when the MTU in the wifi interface (iwn0) is lower than 1500. So I put in /etc/hostname.iwn0:


mtu 1440 up

This is a very odd thing. MTU path discovery is permitted in my firewall configuration (icmp_types = “{ echoreq, unreach }”) and even deactivating PF the problems remain.


Posted in Uncategorized | Tagged , | Leave a comment

OpenBSD: hibernation rules!!!!

Simply great! hibernation in i386 works great!. It seems it could be there some issues but in my experience is pretty usable.

This is the first time I’m able to see hibernation working in a BSD laptop since my Thinkpads T20, T23 and T41 with their bios solution with a dedicated partition. So well done OpenBSD.


Posted in BSD, OpenBSD | Leave a comment

OpenBSD: How to avoid resolv.conf to be touched by dhclient

I prefer to provide DNS address of my choice instead those from my network provider. Usually OpenDNS servers are a good option.

So, to avoid dhclient touch ‘/etc/resolv.conf’ I configure the /etc/dhclient.conf as follows:

initial-interval 1;
send host-name “myhostname”;
#request subnet-mask, broadcast-address, routers, domain-name,
#       domain-name-servers, host-name;
#send dhcp-lease-time 3600;
supersede domain-name-servers, ;
supersede domain-name “”;
request subnet-mask, broadcast-address, routers;

And /etc/resolv.conf.tail :

lookup file bind


Posted in BSD, OpenBSD | Leave a comment

OpenBSD: Laptop cpu temperature control with APM

In OpenBSD, all versions I tested, I note a performance decrease (in such way as not smooth mouse movement, or web page scrolling) when the maching is doing any heavy reading/writing task or cpu compsuming (i.e. ziping/unziping/copying a big file), even when only one core is running this process and the other ones are running at low load.

In Marc Espie’s words (

Yes, there's something deeply fucked up somewhere in our 
scheduler/disk-handling/whatever. The issue is known.

It appears it is complicated to fix properly without replacing
it by a lot of other problems, some of which pertain to keeping
relatively old archs in working condition, or so I'm told.

A workaround to minimize this effect is running APM in automatic mode (maybe the preferred option for most people). I used to running it in Cooling mode to avoid temperature increases.

Now I use a script to control the APM working mode, automatic when the temperature is lower than a certain threshold, cooling when it increases.

The code is:



TIME=5 #seconds

while :
cpu0=`sysctl hw.sensors.cpu0.temp0 | cut -d= -f 2 | cut -d. -f 1`
gpu0=`sysctl hw.sensors.itherm0.temp4 | cut -d= -f 2 | cut -d. -f 1`
apm=`/usr/sbin/apm -P`

echo "CPU0: ${cpu0} GPU0: ${gpu0} APM: ${apm}"

if [ ${cpu0} -gt ${CPU_UP_TH} ] || [ ${gpu0} -gt ${GPU_UP_TH} ]; then
if [ ${apm} == 1 ]; then
/usr/sbin/apm -C
echo "apm -C"

if [ ${cpu0} -lt ${CPU_LOW_TH} ] || [ ${gpu0} -lt  ${GPU_LOW_TH} ]; then
if [ ${apm} == 2 ]; then
/usr/sbin/apm -A
echo "apm -A"

sleep ${TIME}


It can be grabbed from

Use it at your own risk :). Probably it needs to be modified, to adjust thresholds in other laptops.

It would be great if APM work in such way… even apmd needs to be patched in 5.4 for SMP machines (

Posted in BSD, OpenBSD | Tagged , , | Leave a comment

OpenBSD: ntfs-3g supported !!!

I can’t believe it!!!

I’m anxious for testing it … One of those things you miss when moving to OpenBSD from FreeBSD or Linux…


Posted in OpenBSD | Leave a comment

Linux: share 3g connection with the internal network

It’s very easy to share an internet connection with iptables and NAT+IP Forward+IP Masquerade. But in my case I needed to share the 3G connection via wifi, and my computer’s nic is not able to work in ad-hoc mode. So I have to use an external wifi router. This router is connected to my Thinkpad R61’s eth0 port, and it needs to obtain its wan IP address via DHCP. So a DHCP server is needed in order to provide the IP and the Gateway for the wifi router.

I coded a simple script as:



systemctl stop NetworkManager.service

sleep 2

ifconfig eth0 up
service dhcpd restart
sleep 2
ifconfig eth0 up

sleep 2
wvdial 3g &

sleep 2


First relevant line disables the NetworkManager, to avoid the eth0 port gets an IP. eth0 must have an static ip.

Middle lines configures the static IP server address, restart the dhcpd server, and start the 3g connection with wvdial.

Last line launch the firewall (redundant if it is configured as a service).

All the need configurations can be grabbed from:

Linux: DHCP server

Linux: 3G connection with wvdial

Linux: a home firewall

Posted in Linux | Leave a comment