11.nginx.conf 配置示例

来源:互联网 发布:乐视手机mac 编辑:程序博客网 时间:2024/05/21 09:50

nginx.conf :

user  nobody nobody;worker_processes  3;error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;pid        logs/nginx.pid;events {    use epoll;    worker_connections  1024;}http {    autoindex off;    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"';    sendfile        on;    keepalive_timeout  65;    include vhosts/*.conf;}

server.conf

server {        listen 192.168.0.106:80;        server_name 192.168.0.106;        access_log  logs/host.access.log  main;        location / {                root html;                index index.html index.htm;        }        error_page   500 502 503 504  /50x.html;        location = /50x.html {            root   html;        }        location ~ \.php$ {            root           html;            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            #fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html/fpm/$fastcgi_script_name;            fastcgi_param  SCRIPT_FILENAME  $document_root/fpm$fastcgi_script_name;            include        fastcgi_params;        }}