$ curl -s -H "X-Something: yeah" localhost:8000 > /dev/null
$ python serv.py
ERROR:root:User-Agent: curl/7.37.1
Host: localhost:8000
Accept: */*
X-Something: yeah
| #!/bin/bash | |
| docker build https://raw.githubusercontent.com/atricore/atricore-josso-playground/master/oracle-java8/Dockerfile |
| # check WindowsAzurePowerShell is present | |
| if (-not(Get-Module Azure)){ | |
| # find chocolatey executable | |
| $CHOCO = $env:PATH.Split(';') | % {Get-ChildItem -Path $_ -Filter chocolatey.exe} | |
| # install WindowsAzurePowerShell | |
| if ($CHOCO.Exists){Start-Process -FilePath $CHOCO.FullName -ArgumentList "install -y WindowsAzurePowerShell" -Wait} | |
| } else {Write-Warning -Verbose "WindowsAzurePowerShell Exists."} | |
| # connect to Azure | |
| Add-AzureAccount |
| #!/bin/bash | |
| if [[ -z "$1" ]]; then | |
| SHUTDOWN_TIMEOUT="60" | |
| else | |
| SHUTDOWN_TIMEOUT="$1" | |
| fi | |
| echo $SHUTDOWN_TIMEOUT ; exit 0 | |
| SHUTDOWN_DELAY="5" |
| ... | |
| # формат логирования с отслеживанием времени ответа от бэкенда | |
| log_format timed_combined '$remote_addr - $remote_user [$time_local] ' | |
| '"$request" $status $body_bytes_sent ' | |
| '"$http_referer" "$http_user_agent" ' | |
| '$request_time $upstream_response_time $pipe'; | |
| # http://nginx.org/ru/docs/http/ngx_http_limit_req_module.html |
| #!/bin/bash | |
| if ps -ylC apache2 >/dev/null | |
| then | |
| ps -ylC apache2 | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}' | |
| else | |
| ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}' | |
| fi |
| <?php | |
| $status = file_get_contents('/proc/' . getmypid() . '/status'); | |
| print $status . "\n"; |
| # force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf | |
| server { | |
| listen 80; | |
| server_name jira.example.com; | |
| access_log off; | |
| return 301 https://$server_name$request_uri; | |
| } | |
| # /etc/nginx/conf.d/jira.conf | |
| server { |
| # | |
| # http://mywiki.wooledge.org/BashFAQ/035 | |
| # | |
| getopts_lookup(){ | |
| while getopts "h?v:a:p:u:n:" OPTION "$@"; do | |
| case "$OPTION" in | |
| m) has_MSG=true; MSG="$OPTARG"; echo "MSG: $MSG" ;; | |
| p) has_PHONE=true; PHONE="$OPTARG"; echo -e "PHONE: $PHONE \t OPTIND: $OPTIND" ;; | |
| v) has_VERBOSE=true; VERBOSE="$OPTARG"; echo -e "VERBOSE: $VERBOSE \t OPTIND: $OPTIND" ;; |
$ curl -s -H "X-Something: yeah" localhost:8000 > /dev/null
$ python serv.py
ERROR:root:User-Agent: curl/7.37.1
Host: localhost:8000
Accept: */*
X-Something: yeah
| user bitrix; #пользователь, под которым работает nginx. Желательно совпадение с пользователем apache | |
| worker_processes 8; #8 одновременных процессов | |
| error_log /var/log/nginx/error.log warn; | |
| pid /var/run/nginx.pid; | |
| worker_rlimit_nofile 10240; #максимальное число открытых файлов | |
| events { | |
| use epoll; | |
| worker_connections 10240; #максимальное число соединений с одним процессом. Система может одновременно работать с max_clients = worker_processes * worker_connections, т.е. с 81920 соединений, в том числе статических файлов | |
| } |