server {
listen 8008;
root "/home/work/local/nginx/html";
access_log /home/work/var/logs/nginx/gfh.log main;
index index.php;
# 本地静态资源配置
location ~.*\.(js|css|html|gif|jpg|jpeg|png|bmp|swf|woff|eot|ttf|zip)$ {
root "/home/work/local/nginx/html";
}
location ~\.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/work/local/nginx/html/$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9091;
root /home/work/local/nginx/html;
}
}
此文件为nginx扩展配置文件,listen为服务器端口,root后面的目录为nginx解析的目录, location ~\.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/work/local/nginx/html/$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9091;
root /home/work/local/nginx/html;
} 这个模块是解析php以及加载php-fpm。