nginx.conf

#user  nobody;
worker_processes  1;

error_log  /usr/local/nginx/logs/error.log debug;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        /usr/local/nginx/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;

    server {
        listen       80;
        server_name  localhost;
    root /mnt/hgfs/sharefile/wwwroot;
    index index.html index.htm index.php;
       #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   /usr/local/nginx/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 $document_root$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 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    include vhost/*.conf;
}
时间: 2024-08-09 21:53:57

nginx.conf的相关文章

linux下Nginx配置文件(nginx.conf)配置设置详解(windows用phpstudy集成)

linux备份nginx.conf文件举例: cp /usr/local/nginx/nginx.conf /usr/local/nginx/nginx.conf-20171111(日期) 在进程列表里 面找master进程,它的编号就是主进程号. ps -ef | grep nginx 查看进程 cat /usr/local/nginx/nginx.pid 每次修改完nginx文件都要重新加载配置文件linux命令: /usr/local/nginx -t //验证配置文件是否合法 若ngin

Nginx的nginx.conf配置文件中文注释说明

#运行用户    user www-data;        #启动进程,通常设置成和cpu的数量相等    worker_processes  1;    #全局错误日志及PID文件    error_log  /var/log/nginx/error.log;    pid        /var/run/nginx.pid;    #工作模式及连接数上限    events {        use   epoll;             #epoll是多路复用IO(I/O Multip

NGINX配置文件nginx.conf详解

1.配置文件结构 Nginx配置文件主要分成四部分:main(全局设置).server(主机设置).upstream(上游服务器设置,主要为反向代理.负载均衡相关配置)和 location(URL匹配特定位置后的设置),每部分包含若干个指令.main部分设置的指令将影响其它所有部分的设置:server部分的指令主要用于指定虚拟主机域名.IP和端口:upstream的指令用于设置一系列的后端服务器,设置反向代理及后端服务器的负载均衡:location部分用于匹配网页位置(比如,根目录"/"

线上nginx_cache服务器nginx.conf文件详解

#使用的用户和组user  www www;#指定工作衍生进程数(一般等于cpu的总核数或总核数的两倍,例如两个四核cpu,则总核数为8)worker_processes 4;#指定错误日志存放的路径,错误日志记录级别可选项为:[debug|info|notice|warn|error|crit]error_log  /usr/local/nginx/logs/nginx_error.log  crit;#指定pid存放的路径pid        /usr/local/nginx/logs/ng

Nginx(三):nginx.conf配置文件说明 【2】 文件结构和配置高亮

配置文件结构说明: 里面的配置文件有几个,当然最主要是nginx.conf配置文件. Main配置段,是核心配置段. Events { 配置事件的 } Http { } 标准http配置段,可选http配置段,都在http{}这里配置,每一种都是一个独立的. 注意:每一个配置参数都需要以分号结尾 标准模块也叫作核心模块是默认都安装的,如果不想安装就是-without什么,可选模块是默认不安装的,如果想安装就是-with-什么 可选模块比如-with-http_ssl_module和-with-h

CentOS下配置nginx conf/koi-win为同一文件的各类错误

今天配置CentOS6.5下安装Nginx + php7 + mysql5.7.15遇到了一些坑.本来家里的电脑在配置环境的时候没有问题,拿去公司的电脑上就是到处报错.不知道是不是人品问题.今晚在家重装了一个centos,安装之后进行了全部yum update.本来以为上午的问题可能是没有更新软件,图样图森破.下面总结一下今晚对nginx部分的心得. 因为PCRE本来是用在nginx重写rewrite的时候,解析正则的正则解析库,所以在安装nginx之前,默默的先装上基本应用: yum -y i

Nginx配置文件(nginx.conf)配置详解

Nginx的配置文件nginx.conf配置详解如下: user nginx nginx ; Nginx用户及组:用户 组.window下不指定 worker_processes 8; 工作进程:数目.根据硬件调整,通常等于CPU数量或者2倍于CPU. error_log  logs/error.log; error_log  logs/error.log  notice; error_log  logs/error.log  info; 错误日志:存放路径. pid logs/nginx.pi

nginx.conf的events,http段一般固定配置

1 nginx.conf的events,http段一般固定配置 2 user nobody nobody; #使用的用户可以按照实际情况修改 3 worker_processes 2; #指定nginx开启的进程数,将其设置为可用的CPU内核数将是一个好的开始 4 error_log /usr/local/nginx/logs/nginx_error.log crit; 5 pid /usr/local/nginx/logs/nginx.pid; 6 worker_rlimit_nofile 5

后端服务器nginx.conf

user www-data; worker_processes 8; pid /run/nginx.pid; events { use epoll; #当并发量比较大的时候使用这个设置可以节省CPU使用 worker_connections 40000; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types

nginx.conf减肥记

问题,nginx.conf文件过长,过大,不方便维护,所以想拆分出来,这样好阅读也好维护. 1,将nginx里面关于weixin的配置全部剥离出来 如下,这是nginx.conf配置文件中的微信配置记录 ,以后会越来越多的. location ~* ^/weixin_g1.*$ { include deny.conf; proxy_pass http://weixin_web_9600; include proxy.conf; error_log logs/weixin_g1_error.log