got caching working
This commit is contained in:
parent
3fabbe0fec
commit
cf460a79f9
|
@ -10,3 +10,4 @@ services:
|
|||
volumes:
|
||||
- ./nginx-conf/default.conf.template:/etc/nginx/templates/default.conf.template
|
||||
- ./nginx_logs:/var/log/nginx
|
||||
- ./nginx-conf/nginx.conf:/etc/nginx/nginx.conf
|
||||
|
|
|
@ -14,7 +14,7 @@ Response: <span id="response"></span>
|
|||
<script>
|
||||
$(function() {
|
||||
$.ajax({
|
||||
url: 'http://localhost:8080/service?url=http://192.168.2.214:3000/',
|
||||
url: 'http://localhost:8080/service?url=https://google.com/',
|
||||
success: res => {
|
||||
$('#response').text(res);
|
||||
},
|
||||
|
|
|
@ -5,6 +5,10 @@ server {
|
|||
|
||||
resolver 127.0.0.11;
|
||||
|
||||
|
||||
proxy_cache mycache;
|
||||
proxy_cache_valid 200 15s;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log debug;
|
||||
|
||||
|
@ -13,5 +17,6 @@ server {
|
|||
proxy_pass $arg_url;
|
||||
proxy_hide_header Access-Control-Allow-Origin;
|
||||
add_header Access-Control-Allow-Origin $http_origin;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/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 /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
proxy_cache_path /var/cache/nginx/mycache keys_zone=mycache:10m;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
Loading…
Reference in New Issue