This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For API speed and page responses: | |
--------------------------------- | |
https://github.com/pagespeed/ngx_pagespeed | |
Nginx-Access-Plus is a Nginx module allows limiting access to certain http request methods and client addresses. | |
---------------------------------------------------------------------------------------------------------------- | |
https://github.com/nginx-clojure/nginx-access-plus | |
This module can be used to protect your server in case system load or memory use goes too high. | |
----------------------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# file descriptor | |
# Change 400000 to increase or decrease number of file descriptor | |
echo "* soft nofile 400000" >> /etc/security/limits.conf | |
echo "* hard nofile 400000" >> /etc/security/limits.conf | |
# Changing kernal parameters (modify value if required) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Debian packages nginx-extras, lua-zlib required | |
ngx.ctx.max_chunk_size = tonumber(ngx.var.max_chunk_size) | |
ngx.ctx.max_body_size = tonumber(ngx.var.max_body_size) | |
function create_error_response (code, description) | |
local message = string.format('{"status":400,"statusReason":"Bad Request","code":%d,"exception":"","description":"%s","message":"HTTP 400 Bad Request"}', code, description) | |
ngx.status = ngx.HTTP_BAD_REQUEST | |
ngx.header.content_type = "application/json" | |
ngx.say(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name default_server; | |
listen 80; | |
location / { | |
proxy_pass http://localhost:8080; | |
proxy_set_header X-Real-IP $remote_addr; | |
client_max_body_size 5m; | |
client_body_buffer_size 5m; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## FOR UBUNTU | |
Dependencies install | |
1. apt-get install nginx-extras | |
2. apt-get install lua-zlib | |
lua file decompress request body | |
-------------------------------- | |
see https://gist.github.com/iammehrabalam/30f5402bbcdad139c9eafd3a6f47ce6c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install tor | |
# check tor service running on port 9050 (ss -aln | grep 9050) | |
# change ip after every 10 sec | |
edit vi /etc/tor/torrc and add MaxCircuitDirtiness 10 | |
# use tor proxy in python request | |
install requests==2.10.0 (pip install requests==2.10.0) (currently 2.11 giving error) |