marfeel:test
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
marfeel:test [2020/03/16 12:21] – dodger | marfeel:test [2020/03/16 12:33] – dodger | ||
---|---|---|---|
Line 19: | Line 19: | ||
* id : '' | * id : '' | ||
+ | \\ | ||
+ | ==== nginx ==== | ||
+ | I've configured nginx with a bare minimal setup: | ||
+ | <file config / | ||
+ | user www-data; | ||
+ | worker_processes auto; | ||
+ | pid / | ||
+ | events { | ||
+ | worker_connections 768; | ||
+ | } | ||
+ | http { | ||
+ | server_tokens off; | ||
+ | sendfile on; | ||
+ | tcp_nopush on; | ||
+ | tcp_nodelay on; | ||
+ | |||
+ | ## Start: Timeouts ## | ||
+ | client_body_timeout | ||
+ | client_header_timeout 10; | ||
+ | keepalive_timeout | ||
+ | send_timeout | ||
+ | ## End: Timeouts ## | ||
+ | |||
+ | types_hash_max_size 2048; | ||
+ | include / | ||
+ | default_type application/ | ||
+ | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE | ||
+ | ssl_prefer_server_ciphers on; | ||
+ | access_log / | ||
+ | error_log / | ||
+ | |||
+ | # compress everything | ||
+ | gzip on; | ||
+ | # disabled by marfeel request: | ||
+ | # | ||
+ | # you have chosen it :-) | ||
+ | # | ||
+ | |||
+ | #include / | ||
+ | include / | ||
+ | include / | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Nginx proxy cache setup: | ||
+ | <file config | ||
+ | proxy_cache_path /dev/shm levels=1:2 keys_zone=marfeel: | ||
+ | proxy_cache | ||
+ | # | ||
+ | proxy_cache_key $scheme$proxy_host$request_uri; | ||
+ | proxy_cache_revalidate | ||
+ | </ | ||
+ | |||
+ | Default site: | ||
+ | <file config / | ||
+ | server { | ||
+ | listen 80 default_server; | ||
+ | listen [::]:80 default_server; | ||
+ | #root / | ||
+ | root / | ||
+ | index index.html index.htm ; | ||
+ | server_name _; | ||
+ | |||
+ | # compress all proxy requests | ||
+ | include conf.d/ | ||
+ | include conf.d/ | ||
+ | |||
+ | location ^~ /cgi-bin { | ||
+ | proxy_pass http:// | ||
+ | proxy_set_header Host $http_host; | ||
+ | proxy_cache_valid any 1m; | ||
+ | expires 10m; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Proxy compression config: | ||
+ | <file config / | ||
+ | # Enable gzip but do not remove ETag headers | ||
+ | gzip on; | ||
+ | gzip_vary on; | ||
+ | gzip_comp_level 4; | ||
+ | gzip_min_length 256; | ||
+ | gzip_proxied any; | ||
+ | #gzip_types application/ | ||
+ | gzip_types *; | ||
+ | </ | ||
+ | |||
+ | Static files '' | ||
+ | <file config / | ||
+ | # serve static files directly | ||
+ | # The ?: prefix is a ' | ||
+ | # the pattern to be captured into $1 which should help improve performance | ||
+ | location ~* ^.+\.(?: | ||
+ | # | ||
+ | expires | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Python http server ==== | ||
+ | I've setup a '' | ||
+ | <file yaml / | ||
+ | [Unit] | ||
+ | Description=marfeel test service | ||
+ | After=auditd.service systemd-user-sessions.service time-sync.target | ||
+ | |||
+ | [Service] | ||
+ | User=marfeel | ||
+ | TimeoutStartSec=0 | ||
+ | Type=simple | ||
+ | KillMode=control-group | ||
+ | WorkingDirectory=/ | ||
+ | ExecStart=/ | ||
+ | Restart=no | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </ | ||
===== Which code have you added to the user-data on launching the instance? ===== | ===== Which code have you added to the user-data on launching the instance? ===== | ||
<code yaml> | <code yaml> | ||
Line 48: | Line 167: | ||
* '' | * '' | ||
* '' | * '' | ||
+ | |||
+ | |||
+ | <WRAP center round info 60%> | ||
+ | '' | ||
+ | </ | ||
\\ | \\ | ||
Line 53: | Line 177: | ||
Code: | Code: | ||
- | <file bash make_it_cool.sh> | + | <file bash / |
#!/bin/bash | #!/bin/bash | ||
Line 234: | Line 358: | ||
\\ | \\ | ||
Config file: | Config file: | ||
- | <file config make_it_cool.config> | + | <file config |
# Our template for re-generate the config | # Our template for re-generate the config | ||
Line 253: | Line 377: | ||
DEBUG=0 | DEBUG=0 | ||
</ | </ | ||
+ | |||
+ | \\ | ||
+ | Setup crontab with desired frequency for refresh, for example: | ||
+ | <code crontab> | ||
+ | */3 * * * * | ||
+ | </ | ||