configuration

Run NodeJS with non-root / user permission using Runit in Ubuntu 12.04 Precise

7 May , 2012  

After leaving NodeJS about 6 month, I still hard to find articles who explain how to running NodeJS services in production mode. This is mean, running NodeJS services by user permission (not by root) and can automatically restart if crashed. Well, this is not only for NodeJS cases, but you can also implement this solution for running Twisted services.

I use Ubuntu 12.04 Precise Pangolin at this guide. Don’t worry, it’s doesn’t have a big difference step with previous Ubuntu version. So, let start!
More…

,

configuration

Solve github ssh key Agent admitted failure to sign using the key. Permission denied (publickey).

20 Apr , 2012  

Today, I change my ssh key and I see this error when pushing commit into my Github repository :

1
2
Agent admitted failure to sign using the key.
Permission denied (publickey).

So, to solve this problem is pretty easy :

1
ssh-add ~/.ssh/id_rsa

,

configuration

How to solve problem HFSplus OS X partition sharing as home partition in Ubuntu

7 Apr , 2012  

I have dual-OS in my Macbook Pro, OS X Leopard and Ubuntu Oneiric. I want to share partition between OS X and Ubuntu. I use hfplus partition (without journaled) as user home in Ubuntu Oneiric. Then the problem begin.

When I adding launcher in Desktop (Ubuntu), it can’t be executed and throw error :

1
the application launcher ".desktop" has not been marked as trusted. if you do not know the source of this file, launching it may be unsafe.

After finding several articles, I try to change UID in this partition (/dev/sda3) into 501 :
http://ubuntuforums.org/showthread.php?t=1751009.

But it still doesn’t works. Using “chmod a+x” on *.desktop, chown ubuntu:ubuntu, allow permission in properties and another tricks giving no results.
More…

,

configuration

How to change font bold style of php HTML in Aptana Studio

11 Feb , 2012  

When opening HTML, CTP or another PHP-HTML files in Aptana Studio 3, i found that all using bold which is annoying for me. So, to make it to be normal fonts :

1. Go to Aptana Studio menu -> “Window Menu”

2. Type “Themes” on left search box.

3. Find element “text.html.basic” and change it “Bold” style by click it.

4. Problem solved!

,

configuration

Aptana delete all my files because SVN failure

20 Jan , 2012  

I use Aptana Studio 3 and Subversive as SVN connector. After checkout some SVN repository, I got that it was failed process. There no confirmation or something alert, but suddenly all my files in the pointed folder was deleted. Yes, it entirely deleted and not in Trash.

I just luck have a Gitosis repository which have backup 1 day ago. If you curious why this happen, it because subversive plugin. So, I recommend you to use subeclipse for Eclipse or Aptana.

If you need the installation Guide, just follow this link :

How to install SVN in Aptana

,

configuration

How to setup git server using gitolite in Ubuntu 11.10 Oneiric

5 Jan , 2012  

We can build git server using gitolite which also we can host into our Ubuntu. First, we wil act as client which need SSH public keys. Generate our ssh public keys and copy into /tmp by :

1
2
ssh-keygen -t rsa
cp ~/.ssh/id_rsa.pub /tmp/local.pub

Now, we should install dependencies packages by :
More…

,

configuration

Solving could should increase server_names_hash_bucket_size: 32 NGINX Ubuntu

29 Dec , 2011  

After I configure several sites that have a long names in NGINX virtualhost, I restart my NGINX and got this error :

1
2
3
sudo service nginx restart
Restarting nginx: nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
nginx: configuration file /etc/nginx/nginx.conf test failed

Well this is because my NGINX conf only limit server_name into 32 chars. We need to extend it by uncomment “server_names_hash_bucket_size 64;” in nginx.conf :

/etc/nginx/nginx.conf :

1
2
3
4
5
6
7
http {
     ....
     server_names_hash_bucket_size 64;
     # server_name_in_redirect off;

     ....
}

Problem solved! ๐Ÿ˜€

,

configuration

How to disable master password in Eclipse

4 Dec , 2011  

Master password in Eclipse is a bit annoying. We can disable this feature completely. Firstly, you should exit your Eclipse applications. Then follow this steps:

1. Delete equinox security

1
rm -rf ~/.eclipse/org.eclipse.equinox.security

If you use Zend PHP Eclipse or some other, this step will solve the problem.
But, if you still get annoying Master password, then go to next steps :

2. Set text file you master password
For example, I use “nopass” as my master password. So i just echo “nopass” into eclipse master :

1
echo "nopass" > ~/.eclipse/master

More…

,

configuration

Problem with VIM tabnew or new buffer which reset all changes

2 Dec , 2011  

When using VIM, usually I use new buffer or newtab for opening several files. There some anomally where everytime I open another files, my Python indentation going wrong! I don’t know what happen and try spend several hours to find the problem.

Finally, I got the problem ! See this :

1
2
3
4
5
6
setlocal tabstop=4
setlocal softtabstop=4
setlocal shiftwidth=4
setlocal textwidth=80
setlocal smarttab
setlocal expandtab

More…

,

configuration

Solve Overheat in Ubuntu 11.10 with Jupiter + VGA solution

16 Nov , 2011  

Check this for turn off your VGA and decrease overheat fall into 57 C

After suffering overheat ( 80 Celcius ) about 2 month with Ubuntu Oneiric ( 11.10 ), finally i got my HP 431 so cool and it steady on 66 C. No Overheat anymore. Probably the main cause why this happen is VGA driver which i use ATI and there CPU lock on Maximum mode.

UPDATE: Try upgrade your BIOS. Several people have said they reduce heat by upgrading the BIOS.
http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareIndex.jsp?lang=en&cc=th&prodNameId=5086746&prodTypeId=321957&prodSeriesId=5086745&swLang=13&taskId=135&swEnvOID=4061#93211

My solution is by installing proprietary ATI Radeon manually and use Jupiter for “cooling down” my laptop. First, we should install ATI Radeon driver by following my previous article :

http://cisight.com/install-amd-radeon-hd-6470m-and-solve-overheat-on-ubuntu-1110-oneiric/

Second, we should install Jupiter on Ubuntu Oneiric by :

1
2
3
sudo add-apt-repository ppa:webupd8team/jupiter
sudo apt-get update
sudo apt-get install jupiter

After Jupiter installed, we should enable it on systray. You will have problem to enable Jupiter on Ubuntu 11.10 that run Unity or Unity 2D. Why this Jupiter not shown on Unity panel ? It’s because we need to whitelist-ed our application into Unity panel.

To make Jupiter show up on Unity, create a file called “whitelist” :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
SCHEMA="com.canonical.Unity.Panel"
OBJECT="systray-whitelist"
APP="$1"
if [ ! "$(gsettings get $SCHEMA $OBJECT 2>/dev/null || echo FALSE)" = "FALSE" ]; then
  echo "Whitelisting $APP to work around flawed distribution design.."
  OBJARRAY=$(gsettings get $SCHEMA $OBJECT | sed -s -e "s#['##g" -e "s#', '# #g" -e "s#']##g")
  if [[ "${OBJARRAY[@]}" =~ "$APP" ]]; then
    echo "$APP already whitelisted, skipping"
  else
    OBJARRAY=("${OBJARRAY[@]}" $APP)
    OBJARRAY=$(echo ${OBJARRAY[@]} | sed -s -e "s# #', '#g")
    OBJSET="['"$OBJARRAY"']"
    gsettings set $SCHEMA $OBJECT "$OBJSET"
  fi
else
  echo "This is not a Canonical "designed" product."
fi

Note: This script taken from www.fewt.com/2011/03/whitelist-utility-script-to-allow-apps.html.

Execute it by :

1
2
chmod a+x whitelist
./whitelist jupiter

Reboot your Ubuntu to make it works. After the Jupiter menu show up, switch performance mode into “High Performance”.

After this long way, you should have no overheat problem on Ubuntu. ๐Ÿ™‚

,

configuration

Fix host-only adapter Virtualbox can’t dhclient and get ip address

7 Nov , 2011  

I use Ubuntu 11.10 as Host and Ubuntu 11.04 as Guest on Virtualbox 4.1.4. I running VM using Vagrant and Virtualbox (for Desktop version). When i set host-only adapter, i got issue that my network card (eth1) can’t get IP address.

This is weird which i have this work before. Switch on-off on network card doesn’t fix this problem. Also, when i delete “/etc/udev/rules.d/70-persistent-net.rules”, the problem still occured.

After diving for a while, i gota the solution.

1. Configure Host-adapter
Go to File -> Preferences -> Network. If you don’t have vboxnet0, you should create new one. Then, we need to configure this host-only adapter to available for static and dhcp ip. Edit this adapter :
For example, i use 33.33.33.1 as my host IP address.
More…

,

configuration

Fix shared folder Ubuntu Guest & Host Virtualbox permission denied

7 Nov , 2011  

After installing Virtualbox Guest Addition, we can share folder in our OS into guest Virtualbox. First, we go to shared folder and add new folder to share. Don’t forget to check auto-mount. Start your VM ( which mine is Ubuntu Oneiric 11.10 ) and go to /media to see sf_ubuntu / sf_folder.

When you click on folder, you will get permission denied. Why this happen? It because your user in VM not registered yet in vboxsf group. All you need is add your username into vboxsf group

1
sudo usermod -G vboxsf -a <your-username>

Then reboot your VM. Soon as you’re login into VM, you will get full access into shared folder ๐Ÿ™‚

,

configuration

Install AMD Radeon HD 6470M and solve overheat on Ubuntu 11.10 Oneiric

31 Oct , 2011  

UPDATE: Try upgrade your BIOS. Several people have said they reduce heat by upgrading the BIOS.
http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareIndex.jsp?lang=en&cc=th&prodNameId=5086746&prodTypeId=321957&prodSeriesId=5086745&swLang=13&taskId=135&swEnvOID=4061#93211

Please note that installing the latest AMD ATI Radeon FGLRX still not solve the overheat issue. I recommend you to switch off the radeon VGA and use Intel VGA card. It will decrease overheat from 90 C fall into 57 C.

I have HP 431 which support with 2 VGA driver, Intel and AMD Ati Radeon HD 6470M. I start install fresh Ubuntu Oneiric by default & use open-source ATI Radeon proprietary driver. Suddenly, my laptop got overheat about 80 C when i start my activity like writing code, run VM and many else. I thought it was kernel bug. After searching through Google and find there no right solution there.

So i start diving into my Ubuntu Oneiric and find that dual-VGA is the main problem here. To check your VGA availability, do “lspci -nn | grep VGA” :

1
2
00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09)
01:00.0 VGA compatible controller [0300]: ATI Technologies Inc NI Seymour [AMD Radeon HD 6470M] [1002:6760]

More…

,

configuration

Install and configure Vagrant on Ubuntu Oneiric 11.10

23 Oct , 2011  

Installing Vagrant on Ubuntu 11.04 using base tutorial on vagrantup.com will give success result. But not with Ubuntu Oneiric. This is because gem path changes and “Invalid gemspec invalid date format in specification”.

Here are right steps to install & run Vagrant on Ubuntu 11.10 :

1. Install & Configuring Virtualbox
Go to https://www.virtualbox.org/wiki/Linux_Downloads and install as your Ubuntu Oneiric version (32 or 64 bit).

1
2
A. Install by "sudo dpkg -i virtualbox-package.deb".
B. Add your users into vbox group

2. Install ruby and gems

1
sudo apt-get install rubygems ruby1.8

3. Install Vagrant

1
sudo gem install vagrant

After installing, when you type “vagrant”, you will get error like this :
More…

,

configuration

Configuring CakePHP works in sub-folder Localhost NGINX

21 Oct , 2011  

Building CakePHP in sub-folder of localhost is a common way. If you use NGINX as web server for development, we need to setup several thing to make CakePHP works in sub-folder. For example, i have one CakePHP applications

1
2
3
4
5
6
7
localhost
 |_ mycakephp
       |_ app
       |_ cake
       |_ vendors
       |_ plugins
       |_ ...

So, i need to open my CakePHP apps from http://localhost/mycakephp. To make it’s works :

1. Edit /etc/nginx/sites-available/default

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
server {
    listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    root /var/www;
    access_log  /var/log/nginx/access.log;
    error_log  /var/log/nginx/error.log;
   
    index index.php index.html index.htm;

    # Make site accessible from http://localhost/
    server_name localhost;
    # server_name_in_redirect off;
   
    location / {
        autoindex on;
        # This is cool because no php is touched for static content
        try_files $uri $uri/ /index.php;
    }
   
    # rewrite rules for cakephp
    location /mycakephp {
        if (!-e $request_filename) {
            rewrite ^/mycakephp(.+)$ /mycakephp/app/webroot/$1 last;
            break;
        }
    }
   
    location /mycakephp/app/webroot {
        if (!-e $request_filename) {
            rewrite ^/mycakephp/app/webroot/(.+)$ /mycakephp/app/webroot/index.php?url=$1 last;
            break;
        }
    }

    ......

2. Restart NGINX services

3. Open your cakephp Applications.

4. Done ๐Ÿ˜€

,

configuration

How get latest NGINX and build deb package on Ubuntu

16 Sep , 2011  

I use Ubuntu Natty 11.04 in this installation which use nginx 0.8.54 as default package. Now, i try to build and install nginx 1.1.3 development into my Ubuntu.

1. Enable NGINX source
Edit “/etc/apt/source.list” and uncomment :

1
deb-src http://archive.ubuntu.com/ubuntu/ natty multiverse

Then you need to reload repository by “sudo apt-get update”
More…

,

configuration

How to remove upstream remote repository in Github

28 Aug , 2011  

When you forking repository, you usually add stream to enable push your changes into origin master. Adding stream to remote repository by :

1
git remote add upstream git://github.com/octocat/Spoon-Knife.git

But how to remove upstream if we use wrong github repository. Adding again will throw error “fatal: remote upstream already exists”, for example like this:

1
fatal: 'git//github.com/narfdotpl/jquery-typing.git' does not appear to be a git repository

To solve this problem, edit .git/config and remove upstream :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@github.com:yodiaditya/jquery-typing.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "upstream"]
        url = git://github.com/narfdotpl/jquery-typing.git
        fetch = +refs/heads/*:refs/remotes/upstream/*

Into

1
2
3
4
5
6
7
8
9
10
11
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@github.com:yodiaditya/jquery-typing.git
[branch "master"]
        remote = origin
        merge = refs/heads/master

Then you can add new upstream git agains. ๐Ÿ™‚

,

configuration

Auto checking errors for Javascript in VIM using JavascriptLint

25 Aug , 2011  

I have edited a lot of javascript files in VIM. Checking errors in a lot of javascripts line is such a pain till i found JavasriptLint + VIM Plugin. Let get started, i use Ubuntu Natty 11.04 on this installation.

Updated!
You can fork it on Github :
Davepacheco’s javascriptlint Github

1. Install JavascriptLint

1
2
3
4
5
6
cd ~/
wget -c http://www.javascriptlint.com/download/jsl-0.3.0-src.tar.gz
tar -xvvf jsl-0.3.0-src.tar.gz
cd ~/jsl-0.3.0/src/
make -f Makefile.ref
sudo ln -s ~/jsl-0.3.0/src/Linux_All_DBG.OBJ/jsl /usr/local/bin/jsl

2. Install JavascriptLint.vim

Download from http://www.vim.org/scripts/script.php?script_id=2578.

Or if youre using Vundle / Pathogen, then you can use this github :
http://github.com/joestelmach/javaScriptLint.vim.

Now, every you edit JS files, you will see error syntax checking windows in bottom of your VIM. Great tools!

,

configuration

Solving Snipmate vim error Snippet c) is already defined

23 Aug , 2011  

Today i get these errors after forking my github :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Warning in snipMate.vim: Snippet c) is already defined. See :h multi_snip for help on snippets with multiple matches.
Warning in snipMate.vim: Snippet date is already defined. See :h multi_snip for help on snippets with multiple matches.
Warning in snipMate.vim: Snippet ddate is already defined. See :h multi_snip for help on snippets with multiple matches

Warning in snipMate.vim: Snippet while is already defined. See :h multi_snip for
help on snippets with multiple matches.
Warning in snipMate.vim: Snippet r is already defined. See :h multi_snip for hel
p on snippets with multiple matches.
Warning in snipMate.vim: Snippet w is already defined. See :h multi_snip for hel
p on snippets with multiple matches.
Warning in snipMate.vim: Snippet rw is already defined. See :h multi_snip for he
lp on snippets with multiple matches.
Warning in snipMate.vim: Snippet defs is already defined. See :h multi_snip for
help on snippets with multiple matches.
Warning in snipMate.vim: Snippet defmm is already defined. See :h multi_snip for
help on snippets with multiple matches.
Warning in snipMate.vim: Snippet am is al

What the heck with this snipMate problem? Until i remember something ๐Ÿ˜€

here are the solution :

delete snippets folder in bundle/snipmate.vim. This error happen because you already have another snipmate snippets in bundle folder. Just delete the default snippets in Snipmate.vim and all problems gone!

,

configuration

Hot tips collection about using VIM

21 Aug , 2011  

Today i try to learn VIM and found several trivial things that probably gain my effectivity about using VIM. Note that i use VIM for editing PHP, Python, Javascript, CSS and HTML. Also i create my own VIM like Netbeans ( Which it’s still my primary IDE for web development ) in http://github.com/yodiaditya/vim-netbeans. Here are hot tips :

How to indent visual blocks in VIM ?
After blocking using v, now press > for right indentation or < for indentation. Press . for repeat it's command if you think need to indent more. Fix indent width by put shiftwidth=2 or more in .vimrc. For auto-indent, press == How to block one line in VIM ?
Using shift+v

How to paste with indentation included ?
After blocking code with v and y (for yanking / copy ), select your cursor to where the start aligning position. Then you can use ]p for paste text aligning indentation with surroundings

I will update this post as i found another tips.

,

configuration

How to learn and customized VIM like Netbeans for PHP + Python

13 Aug , 2011  

Today i start learning VIM which it takes me scracth my head overtime. Need a full 1 day to know that VIM actually is a powerfull text editor on the earth. Here are the reason why i and you should move into VIM rather using IDE editor :

1. VIM is widely used by many TOP developers around the world.
There so many great developer using VIM as default editor. Also, this editor became as standard in many insitution, big company and community. I heard that Googlers also using VIM with their custom configuration to editing and integrate with Google System.

2. VIM is text-editor that can be programmed.
For example, you need to edit Phyton files and press Shift+E to execute this file immediatelly. Which you can programmed Shift+E equal with command “/usr/bin/python your-script.py”. In another tabs, you need to do same thing, which Shift+e equal with “/usr/bin/php your-script.php”. You need text-editor that doing different service as based on the file extension.

Or maybe, you want to press F4 to commit this file into Github repo. It’s can be programmed as long as what you wanted to. You can make custom text editor based on your standard programming.

3. There only one editor that can match with VIM, called Netbeans. And yes, i still using Netbeans for editing some projects. And it’s still okay dude.

4. VIM is kind of investment. Just like you are PHP programmer that look Python is great language in the future. We need to invest them to be able catch up need in the future.

Being Technical.

When you start to learning VIM, i suggest to give one full day and use is as many time you have. Practice is one key to gain your skill on everything.

I use Ubuntu 11.04 and Macbook Pro here. So, what i share here is 100% working on Ubuntu.

I assume you’re newbies like me before knowing VIM. So, there are 2 things that you should know about VIM, that called .vimrc & .vim. This are located on your home directory ( ~/ ).

.vimrc is contain VIM configuration and .vim contain many plugins, syntax, documentation and many additional things that loaded by .vimrc when you opening VIM. So, start to search about .vimrc and .vim on Google.

Basic things to use VIM ( quotes not included ):

1. To editing file, press “i” or “Insert”
2. To back into command mode, press “CTRL+C” and press “:” for start execute command
3. To save, press “:w”
4. To save and quit, press “:wq”
5. When you see it’s meaning Backslash Button
6. Use “CTRL+F” for PAGE DOWN and “CTRL+B” for PAGE UP
7. In command mode, you can use UP and DOWN arrow to use same command before. Like in shell.

How to copy paste in VIM ?

1. Press “v” and using your arrow keys to block some text
2. Press “d” to cut or “y” for copy. Then press “p” to paste

How to search in VIM ?
1. Press “:/” and type what do you want to search. ex: :/hello
2. To next search, press “n”

How to execute this script on VIM ?
Use “:! %”. Example, execute this python script by “:!python %”

That’s for basic. Now, i am approaching how to make VIM like my Netbeans editor which it have autocomplete, file tree, tag / function list, auto indentation and many else!

Actually, i’m going crazy here. So, i start build my VIM. I suggest you to open vimrc and follow link and documentation there. It’s will helping you to customize VIM as what you want.
Here are some of my steps ( All explanation already in vimrc ) :

1. Editing .vimrc and make basic things.

1
2
3
4
5
6
7
8
9
syntax on " syntax highlighing
filetype on " try to detect filetypes
filetype plugin indent on " enable loading indent file for filetype
set number " Display line numbers
set numberwidth=1 " using only 1 column (and 1 space) while possible
set background=dark " We are using dark background in vim
set title " show title in console title bar
set wildmenu " Menu completion in command mode on
set wildmode=full " cycles between all matching choices.

2. NerdTree ( https://github.com/scrooloose/nerdtree )
After clone it, copy all files into ~/.vim by

1
cp -dR nerdtree/* ~/.vim/

To start using NerdTree, type :NERDTree in Vim. To move between windows, press “CTRL+w+w”

3. Pathogen
Why we should you Pathogen? Here is some cases. You have downloaded many plugins into VIM folder. In one day, some of your plugins updated. Then, what you should do? Deleting old files ? What happen if you delete wrong files?. Using Pathogen will ease our development which make each plugin run independently and updated from github.

Thank to https://github.com/tpope.

To install Pathogen :

1
2
3
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim
&gt; ~/.vim/autoload/pathogen.vim

3. Snipmate
Is TextMate on VIM. I use Snipmate from Tpope as maintainer

1
2
3
4
% cd ~/.vim
% mkdir bundle
% cd bundle
% git clone git://github.com/garbas/vim-snipmate.git

# Install dependencies:
% git clone https://github.com/tomtom/tlib_vim.git
% git clone https://github.com/MarcWeber/vim-addon-mw-utils.git
% git clone https://github.com/honza/snipmate-snippets.git

4. Installing Python Debugger like Pylint, Pyflakes and Pep8

1
2
3
sudo pip install pylint
sudo pip install pyflakes
sudo pip install pep8

For TLDR;
Go to https://github.com/yodiaditya/vim-netbeans and clone it!

,

configuration

Fixing Memcached Problem in Ubuntu Natty

8 Aug , 2011  

When restarting Memcached service, suddenly i got this kind of error :

1
2
3
4
5
6
7
8
Restarting memcached: perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
memcached.

After googling for a while, i got the solution is :

1
sudo apt-get install language-pack-en-base

Kudos to http://bookmarks.honewatson.com/2009/05/30/perl-warning-please-check-that-your-locale-settings-ubuntu/

,

configuration

NGINX configuration for CodeIgniter 2.0

17 Jul , 2011  

This is my NGINX configuration for running CodeIgniter 2.0.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
server {

    listen   80; ## listen for ipv4

    server_name ci;
    root        /your-public-html;
    access_log  /var/log/nginx/yourdomain.access.log;
    error_log  /var/log/nginx/yourdomain.error.log;

    # If file is an asset, set expires and break
    location ~* .(ico|xml|gz|xml.gz|css|js|gif|jpe?g|png)(?[0-9]+)?$ {
        expires max;
        break;
    }

    location / {
        index  index.php index.html index.htm;

        if (-f $request_filename) {
            expires 30d;
            break;
        }

        if (!-e $request_filename) {
            rewrite ^(.+)$ /index.php?$1 last;
            break;
        }

    }

    location ~ .php$ {
        fastcgi_send_timeout 1800;
        fastcgi_read_timeout 1800;
        fastcgi_connect_timeout 1800;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME /your-public-html/$fastcgi_script_name;
        include fastcgi_params;
    }


    location ~ /.ht {
        deny  all;
    }
}

@kudos to Buclar :
If you get some problem, then you should set uri_protocol to $config[‘uri_protocol’] = โ€˜REQUEST_URIโ€™;

,

configuration

Solve blank page URL Rewrite CodeIgniter in Subfolder using .htaccess

17 Jul , 2011  

When we place CodeIgniter as subfolder in localhost environment, it will have some problem with URL rewrite. For example, i have http://localhost/codeigniter. So, if we using default tutorial on CodeIgniter without carefully then it will throw us into โ€œblank pageโ€ and without any error.

Configuring Codeigniter for subfolder is easy. Here the steps :

1. Create .htaccess at root instalation folder
More…

,