Category Archives: BSD

FreeBSD: Customize Home, Del, Insert keys for BASH shell

0
Filed under BSD
Tagged as

by nixcraft

By default when you use FreeBSD’s BASH shell and if you hit Home, Del, Insert keys all of them just prints ~ (some garbage is printed ). To get rid of this problem, edit /etc/profile file and define key binding.

1) Open your bash global profile file:
# vi /etc/profile

2) Add following line to it:
export INPUTRC=/usr/local/etc/inputrc

3) Close and save the file

4) Open the file /usr/local/etc/inputrc and define / modify key binding:
# vi /usr/local/etc/inputrc

5) Append following config data:

set meta-flag on
set input-meta on
set convert-meta off
set output-meta on

“\e[1~”: beginning-of-line
“\e[4~”: end-of-line
“\e[5~”: beginning-of-history
“\e[6~”: end-of-history
“\e[3~”: delete-char
“\e[2~”: quoted-insert
“\e[5C”: forward-word
“\e[5D”: backward-word

PhpMyAdmin

0
Filed under BSD
Tagged as

from here

IMPORTANT

The effect of installing phpmyadmin is to discard mysql host based authentication, as connections via phpmyadmin will appear to come from localhost. For this reason, phpmyadmin should be protected by .htaccess as described below.

Install

* ApacheWebServer

* ApacheNexusAuthentication

*

cd /usr/ports/databases/phpmyadmin

make

make install

ln -s /usr/local/www/phpMyAdmin /usr/local/www/data/phpMyAdmin

cd /usr/local/www/data/phpMyAdmin

cp config.inc.php.sample config.inc.php

vi config.inc.php

And change:

$cfg['PmaAbsoluteUri'] = ”;

$cfg['blowfish_secret'] = ”

$cfg['Servers'][$i]['auth_type'] = ‘config’; // Authentication method (config, http or cookie based)?

$cfg['ShowChgPassword'] = FALSE; // simple users or not

to:

$cfg['PmaAbsoluteUri'] = ‘https://yourhost.yourdomain/phpMyAdmin/’;

$cfg['blowfish_secret'] = ‘YourSecRet’

$cfg['Servers'][$i]['auth_type'] = ‘cookie’; // Authentication method (config, http or cookie based)?

$cfg['ShowChgPassword'] = TRUE; // simple users or not

* Add to /usr/local/etc/apache/httpd.conf:

<Directory /usr/local/www/data/phpMyAdmin>

Allow from all

AllowOverride All

</Directory>

* Create /usr/local/www/data/phpMyAdmin/.htaccess as shown in ApacheWebServer in the mod_auth_radius section, except instead of:

require valid-user

use

require user list-of-users

where list-of-users is a space separated list of trusted users

The reason for the .htaccess on the phpMyAdmin directory is to protect the mysql databases from unauthorized access. Often, mysql is configured to permit access from specific hosts, typically localhost, and weak passwords may be employed. phpMyAdmin will connect to the local database and appear to come from localhost, rendering useless mysql host based permissions.

24.3 Portsnap: A Ports Collection Update Tool

0
Filed under BSD, WEB-DEV-LOG
Tagged as
  • Its too bad she won’t live. But then again who does?
  • My mother, I’ll tell you about my mother.  BANG.

The process is now complete, and applications may be installed or upgraded using the updated Ports Collection.

To run both processes consecutively, issue the following command:

# portsnap fetch update

nginx

0
Filed under BSD
Tagged as

nginx -c /usr/local/etc/nginx/nginx.conf -t
/usr/local/etc/rc.d/nginx restart

phpMyAdmin installed

0
Filed under BSD
Tagged as

phpMyAdmin-3.2.0 has been installed into:

/usr/local/www/phpMyAdmin

Please edit config.inc.php to suit your needs.

To make phpMyAdmin available through your web site, I suggest
that you add something like the following to httpd.conf:

Alias /phpmyadmin/ “/usr/local/www/phpMyAdmin/”

<Directory “/usr/local/www/phpMyAdmin/”>
Options none
AllowOverride Limit

Order Deny,Allow
Deny from all
Allow from 127.0.0.1 .example.com
</Directory>

===

add to /usr/local/etc/nginx/nginx.conf

location /phpmyadmin {

alias /usr/local/www/phpMyAdmin/;

}

Create dummy file on freebsd

0
Filed under BSD
Tagged as

dd if=/dev/random of=test bs=1m count=2

This will create 2.0M file called “test”.

This also works on linux, but he doesn’t understand “m” as unit.

I’m affraid /dev/random will be very slow for creating large files or benchmarking.

/dev/urandom is the choice to go with.

FreeBSD group/ user

0
Filed under BSD
Tagged as

Command Summary
adduser(8) The recommended command-line application for adding new users.
rmuser(8) The recommended command-line application for removing users.
chpass(1) A flexible tool to change user database information.
passwd(1) The simple command-line tool to change user passwords.
pw(8) A powerful and flexible tool to modify all aspects of user accounts.

Example 13-7. Adding a Group Using pw(8)

# pw groupadd teamtwo
# pw groupshow teamtwo
teamtwo:*:1100:

Example 13-8. Setting the List of Members of a Group Using pw(8)

# pw groupmod teamtwo -M jru
# pw groupshow teamtwo
teamtwo:*:1100:jru
Example 13-9. Adding a New Member to a Group Using pw(8)

# pw groupmod teamtwo -m db
# pw groupshow teamtwo
teamtwo:*:1100:jru,db

Nginx + PHP + FreeBSD

0
Filed under BSD
Tagged as

/usr/ports/archivers/unzip make install clean

cd /usr/ports/lang/php5/

cd /usr/ports/lang/php5-extensions/

directions from here

FreeBSD Optimizations/boot/loader.conf:

vm.kmem_size=1844M
kern.maxbcache=64M
kern.ipc.maxpipekva=4M

/etc/sysctl.conf:

kern.ipc.nmbjumbop=192000
kern.ipc.nmbclusters=229376
kern.ipc.maxsockets=204800
net.inet.tcp.maxtcptw=163840
kern.maxfiles=204800

kern.ipc.somaxconn=4096

VIM line numbers

:set number

# cd /tmp
# fetch bash.cyberciti.biz/dl/251.sh.zip
# unzip 251.sh.zip
# mv 251.sh /usr/local/etc/rc.d/php.cgi.sh
# chmod +x /usr/local/etc/rc.d/php.cgi.sh
# rm 251.sh.zip
# /usr/local/etc/rc.d/php.cgi.sh start
# sockstat -4 | less

# vi /usr/local/etc/nginx/nginx.conf

server {
listen 80;
server_name theos.in www.theos.in;

access_log /var/log/nginx/theos.in/access.log main;

location / {
root /home/www/theos.in/http;
index index.php index.html index.htm;
}

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

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/www/theos.in/http$fastcgi_script_name;
include fastcgi_params;
}

location ~ /\.ht {
deny all;
}
}
Restart Nginx web server

# nginx -c /usr/local/etc/nginx/nginx.conf -t
# /usr/local/etc/rc.d/nginx restart
Test php with following sample script:

<?php
phpinfo();
?>

WORKING [KEY LINE]

fastcgi_param  SCRIPT_FILENAME  /home/www/soap.bubble.net.cn/htroot$fastcgi_script_name;

nginx -c /usr/local/etc/nginx/nginx.conf -t

FreeBSD List / Display Open Ports

0
Filed under BSD
Tagged as

netstat -a

df -H

sockstat -4 -l

  • The -4 option only displays IPv4 sockets.
  • The -6 option only displays IPv6 sockets.
  • The -c option only displays connected sockets.
  • The -l option only displays listening sockets (open port).

Nginx on freeBSD install started

0
Filed under BSD, WEB-DEV-LOG
Tagged as

/usr/local/sbin/nginx
/usr/local/etc/rc.d/nginx

nginx-0.7.59

COMPILE TIME OPTIONS ENABLED

HTTP_MODULE
HTTP_ADDITION_MODULE
HTTP_FLV_MODULE
HTTP_REWRITE_MODULE
HTTP_SSL_MODULE
HTTP_STATUS_MODULE
[E] MAIL_IMAP_MODULE
WWW [SAMLE FILES]

echo ‘nginx_enable=”YES”‘ >> /etc/rc.conf

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

next

Look into useing  nginx + varnish or memcache

nginx + wordpress rewrite rules

PHP5

explanation of options

  • CLI
  • CGI
  • SUHOSIN
  • FASTCGI
  • PATHINFO