Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nginx] nginx配置相关 #201

Open
david2tdw opened this issue Dec 7, 2020 · 2 comments
Open

[nginx] nginx配置相关 #201

david2tdw opened this issue Dec 7, 2020 · 2 comments

Comments

@david2tdw
Copy link
Owner

No description provided.

@david2tdw
Copy link
Owner Author

server {
        listen 6666;
        server_name  xxx.xxx.xxx.xxx;

	gzip            on;
        gzip_types      text/plain application/xml text/css application/javascript;
        gzip_min_length 1000;
		
        location / {
			
	   expires $expires;
	    proxy_redirect                      off;
            proxy_set_header Host               $host;
            proxy_set_header X-Real-IP          $remote_addr;
            proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto  $scheme;
            proxy_read_timeout                  1m;
            proxy_connect_timeout               1m;
            
	    set $platform_pc 1;
	    if ($http_user_agent ~* '(Android|webOS|iPhone|iPod|BlackBerry)') {
		root E:/xxx/online/front-mobile-ssr;
		set $platform_pc 0;
	   }
	   if ($platform_pc = 1) {
		proxy_pass   http://proxy-server; # set the address of the Node.js instance here
	   }
         }
		
		
		location ^~/api/ {
			proxy_pass http://proxy-server1;
			client_max_body_size    50m;
			client_body_buffer_size 128k;
		}
		
		location ^~/images/ {
		  #expires 24h;
		  root D:/xxx/online/upload-data/;
		  proxy_redirect          off;
		  proxy_set_header   Host $host;
		  proxy_set_header        X-Real-IP       $remote_addr;
		  proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
		  client_max_body_size    50m;
		  client_body_buffer_size 128k;
		  proxy_buffers           32 4k;
		  proxy_connect_timeout   3;
		  proxy_send_timeout      30;
		  proxy_read_timeout      30; 
		}  
		

        #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;
        }
    }

@david2tdw
Copy link
Owner Author

nginx中if....else....通过临时变量来控制循环。

nginx中的if和else语法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant