Tag Archives: configure

Unable to run autoconf on configure.ac

configure.ac:15: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow
See the Autoconf documentation

You can use this solution to solve it.
– sudo pacman -S pkg-config xorg-server-devel libtool automake
– libtoolize –force
– vim configure.ac
– Add AC_CONFIG_MACRO_DIR([m4]) into configure.ac
– libtoolize –force
– aclocal
– autoheader
– automake –force-missing –add-missing
– autoconf

After that, just run ./configure as usual.

535 authentication failed in Roundcube Webmail

If you encounter this kind of error SMTP error 535 Authentication Failed while sending an email from Roundcube Webmail, then you can check the following things.

The error that probably you’ll see:

SMTP error 535 authentication failed in roundcube
SMTP Error (435): Authentication failed

Open this file main.inc.php:

<path>/<to>/<your>/<roundcube>/config/main.inc.php

and change this line:

$rcmail_config['smtp_user'] = '%u';

into this:

$rcmail_config['smtp_user'] = '';

That’s it 😀

WordPress permalinks with Nginx

If you are on Apache(mod_rewrite), WordPress will automatically add the required rewrite rules to your .htaccess file for permalinks to work. Just add code generated by WordPress in .htaccess, and its done. But for nginx, you have to add the rules manually in the nginx conf file.

But the problem is when WordPress detects that mod_rewrite is not loaded (which is this case, nginx), it falls back to using PATHINFO permalinks, which inserts an extra ‘index.php’ in front. This will cause the problem for me as I want to remove the index.php from the permalinks.

Permalink Setting

So you need to edit your nginx configuration file to make the permalinks work. We will use the try_files directive to pass URLs to WordPress’s index.php for them to be internally handled.

If your blog is at the root of the domain (something like www.blog.com), find the location / block inside the configuration file, and add the following line to it.

try_files $uri $uri/ /index.php?q=$uri&$args;

Here, Nginx checks for the existence of a file at the URL ($uri), then for a directory ($uri/). If it doesn’t find a directory or a file, it performs an internal redirect to /index.php passing the URL as PATHINFO.

It should look like this after the edits :

location / {
    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?q=$uri&$args;
}

If your blog is in a subfolder (lets say /blog), you’ll have to add an extra location /blog/ block to your configuration file :

location /blog/ {
    try_files $uri $uri/ /blog/index.php?q=$uri&$args;
}

After you have finished making the changes in the configuration file, reload the nginx configuration:

nginx -s reload

The permalinks should be working fine now.

Install DenyHosts on Ubuntu 12.04

DenyHosts is a security tool written in python that monitors server access logs to prevent brute force attacks on a virtual private server. The program works by banning IP addresses that exceed a certain number of failed login attempts.

1. Install DenyHosts via apt

sudo apt-get install denyhosts

2. Whitelist you IP Addresses
After you install DenyHosts, make sure to whitelist your own IP address. Skipping this step will put you at risk of locking yourself out of your own machine.

To insert you IP, open this file:

sudo nano /etc/hosts.allow

under the description, add in any IP addresses e.g. your IP so that you will not kicked out from the server. You can write each one on a separate line, using this format:

sshd: 12.34.45.678
sshd: 89.76.54.321

After making any changes, be sure to restart DenyHosts so that the new settings take effect on your virtual private server:

sudo /etc/init.d/denyhosts restart

3. Configure DenyHosts (Optional)
If you want to customize the behavior of DenyHosts on your VPS, you can make the changes within the DenyHost configuration file:

sudo nano /etc/denyhosts.conf

socket.io’s `listen()` method expects an `http.server` instance

 For people that has this problem when using node.js & express app, here I show you way to solve it.

The error that you will see upon start the node.js:

Warning: express.createServer() is deprecated, express
applications no longer inherit from http.Server,
please use:

  var express = require(“express”);
  var app = express();

Socket.IO’s `listen()` method expects an `http.Server` instance
as its first parameter. Are you migrating from Express 2.x to 3.x?
If so, check out the “Socket.IO compatibility” section at:
https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x
   info  – socket.io started

The solution is to change this line:

var app = require(‘express’).createServer(),
    io = require(‘socket.io’).listen(app),
    scores = {};                               

// listen for new web clients:
app.listen(8080);

to this:

var express = require(‘express’),
    app = express()
  , http = require(‘http’)
  , server = http.createServer(app)
  , io = require(‘socket.io’).listen(server);

// listen for new web clients:
server.listen(8080);

Try to start again. Problem solve. 🙂

Bridging Ethernet interfaces in Ubuntu 12.04

If you searching tutorial on how to create bridged interface, maybe you’ll refer to Ubuntu documentation. Honestly, it’s hard. Maybe it works. But in my case, it doesn’t.

Nevermind, here I give you guide on how to do it in easier way.

First:

sudo apt-get install bridge-utils

It will create new interface called br0

Second:

sudo brctl addbr br0
sudo brctl addif br0 eth0 eth1

You can restart you interface by this command:

sudo /etc/init.d/networking restart

You also can setup bridged interface automatically on boot by adding this to /etc/network/interfaces:

auto br0
iface br0 inet static
address 192.168.1.10
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
bridge_ports eth0 eth1

The important param is bridge_ports, which assign the ethernet port to bridge interface.

Installing Owncloud on Nginx (Ubuntu 12.04)

Here I want to share with you on how to create your own sync server like dropbox.
The software that we will use is ownCloud.

But before we start, please ensure that you already have the up & running nginx.
For tutorial, please refer here.

1. Make sure your OS is updated

apt-get update
apt-get upgrade

2. Install required package

apt-get install php5-cgi autoconf automake autotools-dev curl libapr1 libtool curl libcurl4-openssl-dev php-pear php-xml-parser php5 php5-cli php5-common php5-curl php5-dev php5-gd php5-sqlite php5-fpm

3. Edit nginx site config file file

vi /etc/nginx/sites-available/default

4. Edit like this;
Copy line below;

server {
        listen   80;
        root /usr/share/nginx/www;
        index index.php index.html index.htm;
        server_name _;

        location / {
                try_files $uri $uri/ @webdav;
        }

        location ~ ^/(data|config|.ht|db_structure.xml|README) {
                deny all;
        }

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

        location ~ .*.(php|php5)?$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+.php)(/.+)$;
                fastcgi_pass unix:/tmp/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }

        location ~ ^/owncloud/remote.php(/.*)$ {
                fastcgi_split_path_info ^(.+.php)(/.*)$;
                fastcgi_pass unix:/tmp/php5-fpm.sock;
                include fastcgi_params;
        }

        location @webdav {
                fastcgi_split_path_info ^(.+.php)(/.*)$;
                fastcgi_pass unix:/tmp/php5-cgi.sock;
                include fastcgi_params;
        }

        location ~ /.ht {
                deny all;
        }
}

The “root /usr/share/nginx/www” line defines the root directory for nginx.
You can change it to other path you like.

5. Edit /etc/php5/conf.d/xcache.ini
Edit this two line;

xcache.size = 64M
xcache.var_size = 64M

6. Edit /etc/php5/fpm/php.ini
Edit this two line;

post_max_size = 2G
max_upload_size = 2G

7. Reload php5-fpm

/etc/init.d/php5-fpm reload

8. Get latest owncloud file (Latest 4.5 (4.5.5))

wget http://mirrors.owncloud.org/releases/owncloud-4.5.5.tar.bz2

9. Extract it at /usr/share/nginx/www

tar xvf owncloud-4.5.5.tar.bz2

So the path will be /usr/share/nginx/www/owncloud after extracted & the URL will be http://localhost/owncloud

10. Set the directory permissions;

chown -R www-data:www-data /usr/share/nginx/www

Replace ‘/usr/share/nginx/www‘ with your own path you prefered. (The path must be the same with the one in /etc/nginx/sites-available/default)

11. Go to http://localhost/owncloud or http:///owncloud
Create new admin account. Also please unsure that the path on data folder is correct.

12. Create new folder name “clientsync“, something like this;

 
13. Get Desktop Sync Clients at here http://owncloud.org/sync-clients/
Install it. Put your credential accordingly.

14. If everything fines, then your owncloud has been configured properly. Congratz!

Done. Hope it helps. 🙂

Installing vsftpd on Ubuntu 12.04

Today I want to share steps on how to install & configure ftp server on Ubuntu.
The server that I’ll use is vsftpd.

1. Make sure your OS is updated

apt-get update
apt-get upgrade

2. Install vsftpd

apt-get install vsftpd

3. Edit the vsftpd config file

vi /etc/vsftpd.conf

Copy this line below:

# Example config file /etc/vsftpd.conf
#
listen=YES
anonymous_enable=NO       # Allow anonymous FTP?
local_enable=YES                # Allow local users to log in
write_enable=YES                # Enable any form of FTP write command
dirmessage_enable=YES      # Activate directory messages
use_localtime=YES
xferlog_enable=YES            # Activate logging of uploads/downloads
connect_from_port_20=YES

secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem

local_root=/usr/share/nginx/www/       # Specifies the directory vsftpd changes to after a user logs in
userlist_enable=YES                             # If user tries to log in using a name in this file, they will be denied before they are asked for a password
userlist_file=/etc/user_list                     # Path to userlist_file

You can change local_root dir to your preferred  that you want.

4. Edit ftpusers file

vi /etc/ftpusers

Comment in-front of word root.

5. Create new file for user_list but do not fill anything

touch /etc/user_list

6. Restart the vsftpd

service vsftpd restart

Done. Hope it helps. 🙂

Changing MySQL root user Password

Bagi sapa2 yang selalu menggunakan MySQL database,
pernah tak jadi kat korang dimana korang terlupa password ‘root’ korang?
Haa.. Aku dah terkena dah sekali..
Dan memang sangat tebaik.. Huhu..

Lalai betul aku nih..
Ntah macam mana aku boleh lupa pulak password aku..
So kat sini aku sharekan solution macam mana nak reset password untuk ‘root’ korang..

  1. Stop kan mysql service

  1. Lepas tu korang start kan balik mysql server tu supaya nanti korang boleh akses ke mysql server tu tanpa menggunakan password

  1. Connect ke mysql server dengan menggunakan mysql client

  1. Buat password baru untuk ‘root’ user

  1. Stop kan mysql server

  1. Start balik macam biasa

Haa.. Dengan mengikuti cara ni, insyallah server MySQL tu boleh diakses sebagai ‘root’ user dengan menggunakan password yang baru korang bubuh tu..

Nginx – 413 Request Entity Too Large

Haa.. Seperti tajuk diatas, bagi sape2 yang pernah configure & run server Nginx ni, korang pernah kena macam ni tak?
Benda ni jadi masa aku nak uploadkan theme kat wordpress.. Nak install theme la..
Saiz theme tu dalam 1.2MB.. Sekali keluar error macam tu..
So, dicari2 solutionnya.. Jumpa jugak..

Mari kita tengok macam mana solution dia..
First, kita kena edit file configuration nginx ni.. Kita taip ni:

Masukkan password korang, dan nanti keluarlah configuration dia kat terminal tu..
Lepas tu kita kena masukkan line ni..

Function dia untuk menetapkan jumlah memori untuk server tu..
Letakkan line tadi tu kat sini..

http {
include /etc/nginx/mime.types;

access_log /var/log/nginx/access.log;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 2;
tcp_nodelay on;

gzip on;
gzip_disable “MSIE [1-6].(?!.*SV1)”;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

client_max_body_size 4M;
client_body_buffer_size 128k;
}

Haa.. Nampak tak? Lepas tu korang tekan CTRL-O untuk write-out dan save..
Nak exit tekan CTRL-Z.. Lepas tu korang try restart nginx korang.. taip kan:

Kalau tak ada masalah apa2, dia akan restart dengan elok.. Lepas tu try korang upload theme tu balik..
Insyallah mesti boleh.. Sebab aku da buat & da jadi pun! 😀
Apa2 pertanyaan bolehlah tanya aku.. Insyallah aku cuba tolong korang..