$ 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
# | |
# Wide-open CORS config for nginx | |
# | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
# |
#!/usr/bin/env python | |
"""Simple HTTP Server With Upload. | |
simpleUploadServer.py | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" |
#!/bin/bash | |
if [[ -z $1 ]]; then | |
NEW_DB="127.0.0.1" | |
else | |
NEW_DB="$1" | |
fi | |
DIR=$(pwd) |
check_mail:0 | |
# color-code each line based on it's http status code "family" | |
colorscheme:nginx | |
cs_re:green:^.* 20.? .*$ | |
cs_re:cyan:^.* 30.? .*$ | |
cs_re:yellow:^.* 40.? .*$ | |
cs_re:red:^.* 50.? .*$ |
server { | |
listen 80; | |
server_name bitrix.example.com; | |
client_max_body_size 200m; | |
root /var/www/bitrix; | |
index index.html index.php; |
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 соединений, в том числе статических файлов | |
} |
$ 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
# | |
# 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" ;; |
# 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 { |
<?php | |
$status = file_get_contents('/proc/' . getmypid() . '/status'); | |
print $status . "\n"; |