전후 단 분리, nginx 용기 역방향 에이전트 nginx. conf 설정 파일

5993 단어
user www www;
	 
worker_processes 2; #    CPU     
error_log /usr/local/nginx/logs/nginx_error.log crit; #         
pid /usr/local/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
  use epoll;
  worker_connections 65535;
}
http
{
	include mime.types;
	default_type application/octet-stream;
	server
	{
		listen 8888;#    
		server_name localhost;#  
		index index.html index.htm index.php;
		root /usr/local/webserver/nginxWeb/html/;#    

		location /live-control{
			proxy_pass http://192.168.13.10:8080/live-control/;
			set $cors '';
			#$http_origin   http   header  origin 
			if ( $http_origin ~* 'http://(localhost|192\.168\.13\.10):8888*') {     
				#            ,                  
				set $cors 'true';
			}
			if ( $cors = 'true') {
				add_header 'Access-Control-Allow-Origin' "$http_origin ";
				add_header 'Access-Control-Allow-Credentials' 'true';
				#       header
				add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
				#       header
				add_header 'Access-Control-Allow-Headers'
				 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With';
			}
			#    (        )     
			if ( $request_method = 'OPTIONS') {
				return 204;
			}
		}
		location / {
		  try_files $uri $uri/ /index.html;
		}
		
	}
  



}

좋은 웹페이지 즐겨찾기