Pages

Saturday 21 March 2015

phpvirtualbox on FreeBSD

Install these:

pkg install virtualbox-ose
pkg install nginx
pkg install php5-soap
pkg install php5-json
pkg install php5-mysqlpkg install php5-sessionpkg install php5-socketspkg install php5-xmlpkg install php5-xmlrpc
pkg install php5-simplexml
pkg install unzip
pkg install virtualbox-ose

You cannot login directly with root over ssh

You will need to create a user and place that user in the wheel group.
Then login with that user and do a su - to become root.

adduser vbox
mkdir /usr/home/vbox
pw usermod vbox -G wheel

You need to load the vboxdrv kernel module via /boot/loader.conf: vboxdrv_load="YES" You also have to add all users to your vboxusers group in order to use vbox. pw groupmod vboxusers -m vbox
chown vbox:vboxusers /usr/home/vbox
Reboot the machine to load the needed kernel modules. Please add the following line to your /etc/rc.conf: vboxnet_enable="YES"
nginx_enable="YES" devfs_system_ruleset="system" 
php_fpm_enable="YES"
vboxwebsrv_enable="YES" vboxwebsrv_user="vbox"
vboxheadless_enable="YES"
vboxheadless_user="vbox" vboxheadless_machines="vm0" vboxheadless_vm0_name="win7" vboxheadless_vm0_user="vbox"
vboxwebsrv_flags="-P /home/ptijo/vboxwebsrv.pid -F /home/ptijo/vboxwebsrv.log -R 5" USB Support: For USB support your user needs to be in the operator group and needs read and write permissions to the USB device. pw groupmod operator -m vbox Add the following to /etc/devfs.rules (create if it doesn't exist): [system=10] add path 'usb/*' mode 0660 group operator Then restart devfs to load the new rules:
/etc/rc.d/devfs restart




chown -R vbox:vboxusers /usr/local/lib/virtualbox
# /usr/local/etc/rc.d/vboxwebsrv start

/usr/local/www/
/usr/local/etc/nginx/nginx.conf

user www;
worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

server {
listen 80;
server_name localhost;

charset utf-8;

location / {
root /usr/local/www/nginx;
index index.php index.html index.htm;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx$fastcgi_script_name;
include fastcgi_params;
}
}
}

VBoxManage setproperty websrvauthlibrary null

References:
http://pc-s.org.ua/?p=756
http://www.tumfatig.net/20120412/the-freebsd-hypervisor-using-virtualbox/
http://www.lissyara.su/articles/freebsd/www/phpvirtualbox/
http://blog.secaserver.com/2011/07/freebsd-nginx-php-fastcgi-installation/
http://habrahabr.ru/post/67152/
http://geekstutorials.com/2010/04/error-pam-authentication-error-for-root-when-trying-to-ssh-to-freebsd-server-as-root/