$ 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
| # Add alias to bash shell | |
| echo "alias json='python -mjson.tool'" >> ~/.bashrc | |
| # Add alias for zsh shell | |
| echo "alias json='python -mjson.tool'" >> ~/.zshrc |
| location /resize { | |
| alias /tmp/nginx/resize; | |
| set $width 150; | |
| set $height 100; | |
| set $dimens ""; | |
| if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) { | |
| set $width $1; | |
| set $height $2; | |
| set $image_path $3; |
| # | |
| # Wide-open CORS config for nginx | |
| # | |
| location / { | |
| if ($request_method = 'OPTIONS') { | |
| add_header 'Access-Control-Allow-Origin' '*'; | |
| # |
| 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
| # 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 { |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |