nginx.conf文件说明

来源:互联网 发布:粉碎食品安全网络谣言 编辑:程序博客网 时间:2024/05/23 05:10

nginx.conf文件说明

复制代码
#Nginx所有用户和组,window下不指定#user  nobody;#工作的子进程数量(通常等于CPU数量或者2倍于CPU)worker_processes  1;#错误日志存放路径#error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;#指定pid(进程id)存放文件#pid        logs/nginx.pid;#执行的事件events {    #允许最大连接数    worker_connections  51200;}http {    # MIME类型就是设定某种扩展名的文件用一种应用程序来打开的方式类型    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通道    #tcp_nopush     on;    #活动时间    #keepalive_timeout  0;    keepalive_timeout  65;    #打开gzip数据流压缩    #gzip  on;    #对于服务的配置    server {        #端口号(如果你本地安装了其他Web服务器,为了避免冲突,这里需要修改)        listen       80;        #服务名,本地或者www.abc.com *.abc.com        server_name  localhost;        #设置字符集        #charset koi8-r;        #打日志        #access_log  logs/host.access.log  main;         location / {            root   html;            index  index.html index.htm;        }        #错误页定义        error_page  404              /404.html;        # redirect server error pages to the static page /50x.html        #        error_page   500 502 503 504  /50x.html;        location = /50x.html {            root   html;        }        # proxy the PHP scripts to Apache listening on 127.0.0.1:80        #        #location ~ \.php$ {        #    proxy_pass   http://127.0.0.1;        #}        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000        #        #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;        #}        # deny access to .htaccess files, if Apache's document root        # concurs with nginx's one        #        #location ~ /\.ht {        #    deny  all;        #}    }    # another virtual host using mix of IP-, name-, and port-based configuration    #    #server {    #    listen       8000;    #    listen       somename:8080;    #    server_name  somename  alias  another.alias;    #    location / {    #        root   html;    #        index  index.html index.htm;    #    }    #}    # HTTPS server    #    #server {    #    listen       443;    #    server_name  localhost;    #    ssl                  on;    #    ssl_certificate      cert.pem;    #    ssl_certificate_key  cert.key;    #    ssl_session_timeout  5m;    #    ssl_protocols  SSLv2 SSLv3 TLSv1;    #    ssl_ciphers  HIGH:!aNULL:!MD5;    #    ssl_prefer_server_ciphers   on;    #    location / {    #        root   html;    #        index  index.html index.htm;    #    }    #}}
复制代码
0 0