linux中国网

linux菜菜鸟的日记

fnmp_conf

# cat /etc/nginx/nginx.conf
#20150915
user  www;
worker_processes  2;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
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;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    gzip  on;
#4 blog
    server {
        listen       80;
        server_name  linuxchina.net;
    #    server_name  blog.linuxchina.net;
        charset utf-8;
        root /word;
        index index.php index.html index.htm;
    #    #access_log  logs/host.access.log  main;
        location / {
            try_files $uri $uri/ =404;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html  {
         root /word;
        }
##
    #    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
     location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        include fastcgi_params;
    #    #location ~ \.php$ {
    #    #    root           html;
    #    #    fastcgi_pass   127.0.0.1:9000;
    #    #    fastcgi_index  index.php;
    #    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    #    include        fastcgi_params;
    #    #}
      }
    }
include /usr/local/etc/nginx/hosts/*.conf;
}
server {
        listen 80;
        server_name  evanlinux.com;
           charset utf-8;
        access_log off;
        root /data/www/wiki;
        index index.php index.htm index.html;
        location ~ .*\.(gif|jpg|jpeg|png|bmp|ico|swf|html|htm|mp3|wma|js|css)$ {
                expires      7d;
        }
   # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
     location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        include fastcgi_params;
        }
}
#evan@bsdvps:~ % cat /usr/local/etc/nginx/hosts/wiki.conf
#include /usr/local/etc/nginx/hosts/*.conf;

评论已关闭。