Tag Archives: static

FreeBSD10.1: separate static access and script (php) access for nginx

This article is based on the php fourm Discuz (http://www.discuz.net), you should modify the configuration as needed.

Operation system: Freebsd 10.1 with ZFS

1. Enable httpready, aio, tmpfs

2. Create tmp mount point for nginx

3. Nginx configuration (nginx version 1.6)

compile nginx from port

make sure that you have enabled below modules:

create log folder

below is the configuration for nginx. Please be aware that I put the configuration in several different files.




I will use map.conf and front.conf to separate static access and script access, also separate human access and robot access.

Use map.conf to sort out different access type:


Use LUA to identify the robots which pretend to be a web browser

cookie.conf (for this script, please refer to http://ocdn.me/nginx-defense.html)





With this configuration, you can set different access rules for human access and bot access, you can also seperate static file access and script(php) access. It can spped up your website and improve the workload of your server.