美文网首页
nginx配置文件

nginx配置文件

作者: 无花无酒_3cd3 | 来源:发表于2020-09-19 16:49 被阅读0次
#  power by www.php.cn
#user  nobody;
worker_processes  1;

#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;
    #tcp_nodelay on;
  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 128k;
  fastcgi_buffers 4 128k;
  fastcgi_busy_buffers_size 256k;
  fastcgi_temp_file_write_size 256k;

  #gzip  on;
  gzip on;
  gzip_min_length  1k;
  gzip_buffers     4 32k;
  gzip_http_version 1.1;
  gzip_comp_level 2;
  gzip_types       text/plain application/x-javascript text/css application/xml;
  gzip_vary on;
  gzip_disable "MSIE [1-6].";

  server_names_hash_bucket_size 128;
  client_max_body_size     100m; 
  client_header_buffer_size 256k;
  large_client_header_buffers 4 256k;
 
    server {
        listen       80;
        server_name  www.buybuywang.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        root    "D:/WWW/knight";
        location / {
            index  index.html index.htm index.php l.php;
           autoindex  off;
        }

        #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(.*)$  {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    server {
         listen 443; #配置HTTPS的默认访问端口号为443。此处如果未配置HTTPS的默认访问端口,可能会造成Nginx无法启动。Nginx 1.15.0以上版本请使用listen 443 ssl代替listen 443和ssl on。
         server_name www.buybuywang.com; #将www.certificatestests.com修改为您证书绑定的域名,例如:www.example.com。如果您购买的是通配符域名证书,要修改为通配符域名,例如:*.aliyun.com。
         root    "D:/WWW";
         index index.html index.htm;
    ssl on;
         ssl_certificate cert\4409179_www.buybuywang.com.pem;  #将domain name.pem替换成您证书的文件名称。
         ssl_certificate_key cert\4409179_www.buybuywang.com.key; #将domain name.key替换成您证书的密钥文件名称。
         ssl_session_timeout 5m;
         ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #使用此加密套件。
         ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用该协议进行配置。
         ssl_prefer_server_ciphers on;
         location / {
         proxy_pass https://www.baidu.com;
       #  root html;  #站点目录。
         index index.html index.htm;
          }
      }
    upstream online{

            server 127.0.0.0:9090 weight=1; 
    }
    server {
         listen 443; #配置HTTPS的默认访问端口号为443。此处如果未配置HTTPS的默认访问端口,可能会造成Nginx无法启动。Nginx 1.15.0以上版本请使用listen 443 ssl代替listen 443和ssl on。
         server_name sand.buybuywang.com; #将www.certificatestests.com修改为您证书绑定的域名,例如:www.example.com。如果您购买的是通配符域名证书,要修改为通配符域名,例如:*.aliyun.com。
         root    "D:/WWW";
         index index.html index.htm;
    ssl on;
         ssl_certificate cert\4517624_sand.buybuywang.com.pem;  #将domain name.pem替换成您证书的文件名称。
         ssl_certificate_key cert\4517624_sand.buybuywang.com.key; #将domain name.key替换成您证书的密钥文件名称。
         ssl_session_timeout 5m;
         ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #使用此加密套件。
         ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用该协议进行配置。
         ssl_prefer_server_ciphers on;
         location / {
         proxy_pass http://online;
       #  root html;  #站点目录。
         index index.html index.htm;
          }
      }
    # 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;
    #    }
    #}

include vhosts.conf;

}




相关文章

  • 第二讲 Nginx模块详解

    本章要点 Nginx 配置文件结构 各个模块的详解 2.1 Nginx配置文件结构 Nginx的配置文件nginx...

  • Nginx配置文件详解

    Nginx配置文件nginx.conf详解 nginx.conf nginx技术一--配置文件nginx.conf...

  • 应用程序常用命令

    nginx: nginx启动:nginx -c nginx配置文件地址检查配置文件是否正确:nginx -t重启n...

  • nginx(五)nginx cmd

    nginx cmd 1、启动nginx start nginx 2、修改配置文件并生效 测试nginx配置文件是否...

  • Nginx配置文件nginx.conf详解和nginx的变量规则

    Nginx配置文件nginx.conf详解 Nginx 总的 配置文件 位置 /usr/local/nginx/c...

  • Nginx使用

    Nginx [toc] nginx命令 参数 Nginx启动 通过指定配置文件启动 配置文件语法检查 Nginx配...

  • nginx配置文件

    nginx配置文件nginx配置文件详解一、nginx配置文件 启动子进程程序默认用户 user nobody;...

  • Nginx 打印body体内容

    Nginx 打印body体内容,修改nginx配置文件nginx.conf 重新加载配置文件 nginx body...

  • nginx(二)

    在修改配置文件后,检查 nginx 配置文件语法是否正确:nginx -t 重新启动 nginx: nginx -...

  • Nginx yum安装目录

    日志切割配置文件/etc/logrotate.d/nginx主要配置文件/etc/nginx/etc/nginx/...

网友评论

      本文标题:nginx配置文件

      本文链接:https://www.haomeiwen.com/subject/moaeyktx.html