diff options
Diffstat (limited to 'nginx-ext-consul/src/assembly/resources/nginx')
3 files changed, 223 insertions, 0 deletions
diff --git a/nginx-ext-consul/src/assembly/resources/nginx/conf/mime.types b/nginx-ext-consul/src/assembly/resources/nginx/conf/mime.types new file mode 100644 index 0000000..09e1b41 --- /dev/null +++ b/nginx-ext-consul/src/assembly/resources/nginx/conf/mime.types @@ -0,0 +1,95 @@ +# +# Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +types { + text/html html htm shtml; + text/css css; + text/xml xml rss; + image/gif gif; + image/jpeg jpeg jpg; + application/x-javascript js; + application/atom+xml atom; + + text/mathml mml; + text/plain txt; + text/vnd.sun.j2me.app-descriptor jad; + text/vnd.wap.wml wml; + text/x-component htc; + + image/png png; + image/tiff tif tiff; + image/vnd.wap.wbmp wbmp; + image/x-icon ico; + image/x-jng jng; + image/x-ms-bmp bmp; + image/svg+xml svg svgz; + + application/java-archive jar war ear; + application/json json; + application/mac-binhex40 hqx; + application/msword doc; + application/pdf pdf; + application/postscript ps eps ai; + application/rtf rtf; + application/vnd.ms-excel xls; + application/vnd.ms-powerpoint ppt; + application/vnd.wap.wmlc wmlc; + application/vnd.google-earth.kml+xml kml; + application/vnd.google-earth.kmz kmz; + application/x-7z-compressed 7z; + application/x-cocoa cco; + application/x-java-archive-diff jardiff; + application/x-java-jnlp-file jnlp; + application/x-makeself run; + application/x-perl pl pm; + application/x-pilot prc pdb; + application/x-rar-compressed rar; + application/x-redhat-package-manager rpm; + application/x-sea sea; + application/x-shockwave-flash swf; + application/x-stuffit sit; + application/x-tcl tcl tk; + application/x-x509-ca-cert der pem crt; + application/x-xpinstall xpi; + application/xhtml+xml xhtml; + application/zip zip; + + application/octet-stream bin exe dll; + application/octet-stream deb; + application/octet-stream dmg; + application/octet-stream eot; + application/octet-stream iso img; + application/octet-stream msi msp msm; + application/ogg ogx; + + audio/midi mid midi kar; + audio/mpeg mpga mpega mp2 mp3 m4a; + audio/ogg oga ogg spx; + audio/x-realaudio ra; + audio/webm weba; + + video/3gpp 3gpp 3gp; + video/mp4 mp4; + video/mpeg mpeg mpg mpe; + video/ogg ogv; + video/quicktime mov; + video/webm webm; + video/x-flv flv; + video/x-mng mng; + video/x-ms-asf asx asf; + video/x-ms-wmv wmv; + video/x-msvideo avi; +}
\ No newline at end of file diff --git a/nginx-ext-consul/src/assembly/resources/nginx/conf/nginx.conf b/nginx-ext-consul/src/assembly/resources/nginx/conf/nginx.conf new file mode 100644 index 0000000..aec103f --- /dev/null +++ b/nginx-ext-consul/src/assembly/resources/nginx/conf/nginx.conf @@ -0,0 +1,62 @@ +# +# Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#user nobody; +worker_processes 2; +worker_rlimit_nofile 65535; + +error_log logs/error.log warn; +pid logs/nginx.pid; + +events { + #there is normally no need to specify the following directive explicitly + #use epoll; + worker_connections 10000; + multi_accept on; +} + +http { + include mime.types; + #default_type text/html; + + log_format main '$remote_addr - $remote_user [$time_local] $request_id "$request" ' + '$status request_processing_time:$request_time upstream_response_time:$upstream_response_time ' + '"$http_referer" "$http_user_agent" "$http_x_forwarded_for"'; + + access_log logs/access.log main; + #access_log off; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + + server_tokens off; + + keepalive_timeout 120s; + keepalive_requests 200; + types_hash_max_size 2048; + + #open_file_cache max=200000 inactive=300s; + #open_file_cache_valid 300s; + #open_file_cache_min_uses 2; + #open_file_cache_errors on; + + gzip on; + gzip_min_length 1000; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml; + + include ../sites-enabled/*.conf; +}
\ No newline at end of file diff --git a/nginx-ext-consul/src/assembly/resources/nginx/sites-enabled/openresty-consul.conf b/nginx-ext-consul/src/assembly/resources/nginx/sites-enabled/openresty-consul.conf new file mode 100644 index 0000000..f4f19ab --- /dev/null +++ b/nginx-ext-consul/src/assembly/resources/nginx/sites-enabled/openresty-consul.conf @@ -0,0 +1,66 @@ +#set conf for proxy pass +proxy_connect_timeout 15s; +proxy_read_timeout 360s; +proxy_send_timeout 120s; +proxy_set_header X-Real-IP $remote_addr; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +proxy_set_header Host $host:$server_port; +proxy_http_version 1.1; +proxy_set_header Connection ""; + +upstream apibackend { + server 127.0.0.1:8076; + keepalive 200; +} +upstream consulbackend { + server 127.0.0.1:8500; + keepalive 200; +} + + +server { + listen 10081; + + location /api/microservices/v1 { + proxy_pass http://apibackend; + } + location /iui/microservices { + root html ; + } + + location /admin/metrics { + proxy_pass http://apibackend; + } + + location /api/msdiscover/v1 { + rewrite ^/api/msdiscover/v1/(.*) /api/microservices/v1/$1 break; + proxy_pass http://apibackend; + } + + location /api/catalog/v1 { + rewrite ^/api/catalog/v1/(.*) /v1/catalog/$1 break; + proxy_pass http://consulbackend; + } + + location /api/health/v1 { + rewrite ^/api/health/v1/(.*) /v1/health/$1 break; + proxy_pass http://consulbackend; + } + + location /api/health_check/v1 { + rewrite /api/health_check/v1 /v1/status/leader break; + proxy_pass http://consulbackend; + } + + location = /favicon.ico { + log_not_found off; + } + + location = /msb { + return 302 $scheme://$http_host/iui/microservices/index.html; + } + + location / { + return 502 ; + } +}
\ No newline at end of file |