nginx的confi常用配置

版权声明:更多信息请关注 wwws.shinians.com 官网 https://blog.csdn.net/zzhuan_1/article/details/83963871

nginx 1配置


user  root;
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  600;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /u01/website;
            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;
        #}
    }
	 #十年官网
	    server {
		listen       80;

		server_name  www.shinians.com;

		#---------配置X-Frame-Options----------
		#add_header X-Frame-Options "SAMEORIGIN";

		#charset koi8-r;
		#access_log  logs/host.access.log  main;

		location / {
		    proxy_pass http://115.28.166.113/;
		    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;
		}
	    }

	 #十年静态站点
	    server {
		listen       80;

		server_name  moban.shinians.com;

		#---------配置X-Frame-Options----------
		#add_header X-Frame-Options "SAMEORIGIN";

		#charset koi8-r;
		#access_log  logs/host.access.log  main;

		location / {
		    
		    root   /u01/website;
		    index  index.html index.htm;
		}
               location /limp/{
                root  /u01/website/limp/;
                autoindex on;
}
		#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   /u01/website;
		}
	    }

	     #LP系统办公
	    server {
		listen       80;

		server_name  team.shinians.com;

		#---------配置X-Frame-Options----------
		#add_header X-Frame-Options "SAMEORIGIN";
                #charset koi8-r;
		#access_log  logs/host.access.log  main;

		location / {
		    proxy_pass http://47.104.15.190:8090;
		     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;
		}
	    }
	    

	     server {
		listen       80;

		server_name  cas.shinians.com;

		#---------配置X-Frame-Options----------
		#add_header X-Frame-Options "SAMEORIGIN";

		#charset koi8-r;
		#access_log  logs/host.access.log  main;
              
		location / {
		    proxy_pass http://114.112.193.6:38800;
		    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;
		}
	    }
	     
	     #统一用户
	    server {
		listen       80;

       		server_name  uums.shinians.com;
                client_header_timeout 100m; 
client_body_timeout 100m; 
proxy_connect_timeout 600s; 
proxy_read_timeout 100m; 
proxy_send_timeout 100m;

		#---------配置X-Frame-Options----------
		#add_header X-Frame-Options "SAMEORIGIN";

		#charset koi8-r;
		#access_log  logs/host.access.log  main;
              
		location / {
		    proxy_pass http://47.92.125.222/;
		    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;
		}
	    }
	    

    # 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/1527596557899.pem;
        ssl_certificate_key   ../cert/1527596557899.key;

        ssl_session_cache    shared:SSL:1m;
        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 / {
            root   html;
            index  index.html index.htm;
        }
    }

}

nginx 2配置


user  root;
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  600;

    #gzip  on;

  #consumer IP组
    upstream consumers{
        server 10.2.8.111:8080 weight=1;
        server 10.2.8.112:8080 weight=1;
	server 10.2.8.113:8080 weight=1;
        server 10.2.8.114:8080 weight=1;
       }


    server {
        listen       8081;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass http://consumers;
        }

        #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;
        #}
    }
	 #cousumer 
	    server {
		listen       80;

		server_name  www.shinians.com;

		#---------配置X-Frame-Options----------
		#add_header X-Frame-Options "SAMEORIGIN";

		#charset koi8-r;
		#access_log  logs/host.access.log  main;

		location / {
		    proxy_pass http://115.28.166.113/;
		    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;
		}
	    }

	 server {
		listen       80;

		server_name  cas.shinians.com;

		#---------配置X-Frame-Options----------
		#add_header X-Frame-Options "SAMEORIGIN";

		#charset koi8-r;
		#access_log  logs/host.access.log  main;
              
		location / {
		    proxy_pass http://47.104.15.190:8091/;
		    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;
		}
	    }
	     
	 
	    

    # 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/1527596557899.pem;
        ssl_certificate_key   ../cert/1527596557899.key;

        ssl_session_cache    shared:SSL:1m;
        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 / {
            root   html;
            index  index.html index.htm;
        }
    }

}

配置3


#user  nobody;
worker_processes  4;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;

worker_rlimit_nofile 65535;  

events {
    worker_connections  65535;
}

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;

    
	#tcp_nodelay on;
	#types_hash_max_size 2048;

    #keepalive_timeout  0;
    client_header_timeout  350;
    client_body_timeout    350;
    keepalive_timeout  350;
    proxy_connect_timeout  350;
    proxy_send_timeout     350;
    proxy_read_timeout     350;

    #gzip  on;
    #gzip  on;
    #upstream nyyyw { server 202.127.46.64:80;    }
    #upstream naxy{ server 202.127.46.51:80; }
    #upstream lssp{ server 202.127.46.100:6888; }

    #gzip on;
    #gzip_disable "msie6";

    access_log off;

    #
    server {
        listen       8090;

        server_name  localhost;

        #---------配置X-Frame-Options----------
        #add_header X-Frame-Options "SAMEORIGIN";

        #charset koi8-r;
        #access_log  logs/host.access.log  main;

        location / {
	    proxy_pass http://10.2.12.74;
            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;
        }
    }
 
    #普元ESB
    server {
        listen       8091;

        server_name  localhost;

        #---------配置X-Frame-Options----------
        #add_header X-Frame-Options "SAMEORIGIN";

        #charset koi8-r;
        #access_log  logs/host.access.log  main;

        location / {
	    proxy_pass http://10.2.12.76;
            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;
        }
    }

    
    

    #主数据管理组件
    server {
        listen       8094;

        server_name  localhost;

        #---------配置X-Frame-Options----------
        #add_header X-Frame-Options "SAMEORIGIN";

        #charset koi8-r;
        #access_log  logs/host.access.log  main;
	#charset utf-8;

        location / {
	    proxy_pass http://10.2.12.86;
            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;
        }
    }

    #iserverGIS
    server {
        listen       8092;

        server_name  localhost;

        #---------配置X-Frame-Options----------
        #add_header X-Frame-Options "SAMEORIGIN";

        #charset koi8-r;
        #access_log  logs/host.access.log  main;
	#charset utf-8;

        location / {
	    proxy_pass http://10.2.12.99;
	    proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-For $remote_addr;
            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;
        }
    }
}

猜你喜欢

转载自blog.csdn.net/zzhuan_1/article/details/83963871