- NGINX Plus repo setup and install instructions (https://cs.nginx.com/repo_setup)
- NGINX Open Source install instructions (http://nginx.org/en/docs/install.html)
- NGINX syntax highlighting in vim (https://gist.github.com/kmjones1979/e3580525801254844e3b3f57989cbd38)
- NGINX command line switches (https://nginx.org/en/docs/switches.html)
- NGINX directives index (http://nginx.org/en/docs/dirindex.html)
- NGINX variables index (http://nginx.org/en/docs/varindex.html)
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
vrrp_script chk_nginx_service { | |
script "/usr/lib/keepalived/nginx-ha-check" | |
interval 3 | |
weight 50 | |
} | |
vrrp_instance VI_1 { | |
interface eth0 | |
state MASTER |
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 { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name _; | |
status_zone example.com_80; | |
location / { |
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 { | |
listen 80; | |
server_name example.com *.example.com; | |
status_zone example_com_80; | |
location / { | |
proxy_pass http://backend; | |
} |
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 { | |
listen 8001; | |
listen 8002; | |
server_name example.com *.example.com; | |
status_zone backend_800X; | |
location / { | |
return 200 "This is a server listening on $server_addr:$server_port \n"; |
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 { | |
listen 8080; | |
server_name localhost example.com *.example.com; | |
location / { | |
return 301 /status.html; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { |
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 | |
wget -O nginx.vim http://www.vim.org/scripts/download_script.php\?src_id\=19394 | |
mkdir -p ~/.vim/syntax | |
mv nginx.vim ~/.vim/syntax/ | |
echo "au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif" | tee -a ~/.vim/filetype.vim |
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
user nginx; | |
worker_processes auto; | |
error_log /var/log/nginx/error.log notice; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
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
user nginx; | |
worker_processes auto; | |
error_log /var/log/nginx/error.log info; | |
pid /var/run/nginx.pid; | |
events { worker_connections 1024; } | |
http { | |
default_type text/html; | |
log_format main '$remote_addr -> $request $status $body_bytes_sent bytes -> $upstream_addr'; | |
access_log /var/log/nginx/access.log main; |
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
events { worker_connections 2014; } | |
http { | |
default_type text/plain; | |
log_format cookie '$cookie_route - $route_cookie, ' | |
'$request_uri - $route_uri, ' | |
'$route - $upstream_addr'; | |
error_log /var/log/nginx/debug_error.log debug; |