user www www;
worker_processes 8;
worker_cpu_affinity 0001 0010 0100 1000 0001 0010 0100 1000;
#error_log /usr/local/nginx/logs/error.log;
#error_log /usr/local/nginx/logs/error.log notice;
#error_log /usr/local/nginx/logs/error.log info;
#pid logs/nginx.pid;
worker_rlimit_nofile 204800;
events {
use epoll;
worker_connections 204800;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
#ip_hash;
ignore_invalid_headers on;
recursive_error_pages on;
server_name_in_redirect off;
server_tokens off;
gzip on;
gzip_comp_level 9;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
server_names_hash_bucket_size 256;
client_header_buffer_size 16K;
large_client_header_buffers 4 64k;
client_max_body_size 50m;
client_body_buffer_size 256k;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
open_file_cache max=204800 inactive=20s;
open_file_cache_min_uses 1;
open_file_cache_valid 30s;
server
{
listen 80;
server_name www.jb200.com;
index index.html index.php;
root /home/www/blog;
access_log /home/logs/access_lihuipeng.www.jb200.com.log;
if (-d $request_filename){
rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
}
error_page 500 502 503 504 404 403 http://www.jb200.com;
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*.(js|css)?$ {
expires 6h;
}
location ~ .*.(log|txt)$
{
deny all;
}
location ~ .*.(php)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
}
}
7、启动服务
检查是否成功启动:
可见php-cgi和nginx端口已经正常监听了。