This repository has been archived by the owner on Mar 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Nginx Puma
ZeroC0D3 Team edited this page Jan 19, 2018
·
3 revisions
Standard configuration for NGINX at /etc/nginx/site-available/[default]
upstream faye_server {
server dev.zeroc0d3lab.com:9292;
}
upstream staging {
server unix:/home/deploy/zeroc0d3lab.dev/current/tmp/sockets/puma-staging.socket fail_timeout=0;
}
server {
listen 80;
server_name dev.zeroc0d3lab.com;
root /home/deploy/zeroc0d3lab.dev/current/public;
client_max_body_size 300M;
keepalive_timeout 120;
send_timeout 120;
underscores_in_headers on;
error_page 500 /500.html;
try_files /system/maintenance.html $uri/index.html $uri @puma;
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
proxy_connect_timeout 43200000;
proxy_read_timeout 43200000;
proxy_send_timeout 43200000;
location ~ ^/(assets)/ {
root /home/deploy/zeroc0d3lab.dev/current/public;
gzip_static on;
expires 1y;
add_header Cache-Control public;
break;
}
location @puma {
proxy_set_header X-Request-Start "t=${msec}000";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://staging;
}
location /pub-sub {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://faye_server;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
if ($http_user_agent ~* (EasouSpider) ) {
return 403;
}
}
server{
listen 443;
ssl on;
ssl_certificate /etc/ssl/star_zeroc0d3lab_com.pem;
ssl_certificate_key /etc/ssl/zeroc0d3lab.key;
server_name dev.zeroc0d3lab.com;
root /home/deploy/zeroc0d3lab.dev/current/public;
client_max_body_size 300M;
keepalive_timeout 120;
send_timeout 120;
error_page 500 /500.html;
try_files /system/maintenance.html $uri/index.html $uri @puma;
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
proxy_connect_timeout 43200000;
proxy_read_timeout 43200000;
proxy_send_timeout 43200000;
location ~ ^/(assets)/ {
root /home/zeroc0d3/staging/public;
gzip_static on;
expires 1y;
add_header Cache-Control public;
break;
}
location @puma {
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Request-Start "t=${msec}000";
proxy_set_header X-Forwarded-Forr $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://staging;
}
location /pub-sub {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://faye_server;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
if ($http_user_agent ~* (EasouSpider) ) {
return 403;
}
}
upstream faye_server {
server zeroc0d3lab.com:9292;
}
upstream production {
server unix:/home/deploy/zeroc0d3lab/current/tmp/sockets/puma-production.socket fail_timeout=0;
}
server {
listen 80;
server_name zeroc0d3lab.com;
root /home/deploy/zeroc0d3lab/current/public;
client_max_body_size 300M;
keepalive_timeout 120;
send_timeout 120;
underscores_in_headers on;
error_page 500 /500.html;
try_files /system/maintenance.html $uri/index.html $uri @puma;
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
proxy_connect_timeout 43200000;
proxy_read_timeout 43200000;
proxy_send_timeout 43200000;
location ~ ^/(assets)/ {
root /home/deploy/zeroc0d3lab/current/public;
gzip_static on;
expires 1y;
add_header Cache-Control public;
break;
}
location @puma {
proxy_set_header X-Request-Start "t=${msec}000";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://production;
}
location /pub-sub {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://faye_server;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
if ($http_user_agent ~* (EasouSpider) ) {
return 403;
}
}
server{
listen 443;
ssl on;
ssl_certificate /etc/ssl/star_zeroc0d3lab_com.pem;
ssl_certificate_key /etc/ssl/zeroc0d3lab.key;
server_name zeroc0d3lab.com;
root /home/deploy/zeroc0d3lab/current/public;
client_max_body_size 300M;
keepalive_timeout 120;
send_timeout 120;
error_page 500 /500.html;
try_files /system/maintenance.html $uri/index.html $uri @puma;
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
proxy_connect_timeout 43200000;
proxy_read_timeout 43200000;
proxy_send_timeout 43200000;
location ~ ^/(assets)/ {
root /home/deploy/zeroc0d3lab/public;
gzip_static on;
expires 1y;
add_header Cache-Control public;
break;
}
location @puma {
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Request-Start "t=${msec}000";
proxy_set_header X-Forwarded-Forr $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://production;
}
location /pub-sub {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://faye_server;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
if ($http_user_agent ~* (EasouSpider) ) {
return 403;
}
}
sudo nginx -t ## or
sudo /etc/init.d/nginx -t
sudo service nginx reload ## or
sudo /etc/init.d/nginx reload
sudo service nginx restart ## or
sudo /etc/init.d/nginx restart
sudo service nginx start ## or
sudo /etc/init.d/nginx start
sudo service nginx stop ## or
sudo /etc/init.d/nginx stop
Research & Development (RnD) - ZeroC0D3 Team
- Email: [email protected]
- Repository: https://github.com/zeroc0d3lab
- Install-Packages
- Setup-Server
- Setup-Account
- Configuration-Bash
- Configuration-Zsh
- Install-Bash-Theme
- Install-Zsh-Theme
- Install-Docker
- Install-Memcached
- Install-MongoDB
- Install-MySQL
- Install-NodeJS
- Install-PostgreSQL
- Install-Redis
- Install-Ruby
- Install-SQLite3
- Configuration-App
- Configuration-GCM
- Configuration-Hosts
- Configuration-Fstab
- Configuration-Memcached
- Configuration-MongoDB
- Configuration-PostgreSQL
- Configuration-Puma
- Configuration-Swap
- Configuration-Unicorn
- Nginx-Puma
- Nginx-Unicorn
- Logrotate
- Deployment-Dashboard
- Deployment-Configuration
- Deployment-Process
- Deployment-Folder-Structure
- Deploy-Preinstall