Last active
February 16, 2023 13:11
-
-
Save hoangmirs/578909c5ffa4e1530ed03ece1b12c35c to your computer and use it in GitHub Desktop.
NGINX config files
This file contains hidden or 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 nuxt or next app with node server running on 8000 | |
server { | |
listen 80; | |
server_name 212.83.163.175; | |
server_name #domain name; | |
root /home/deploy/app; | |
access_log /home/deploy/app/logs/nginx_access.log; | |
error_log /home/deploy/app/logs/nginx_error.log; | |
try_files $uri $uri/ /index.html; | |
location / { | |
proxy_pass http://localhost:8000; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
} |
This file contains hidden or 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 RAILS app | |
upstream app { | |
# Path to Puma SOCK file, as defined previously | |
server unix:/home/deploy/app/shared/tmp/sockets/puma.sock fail_timeout=0; | |
} | |
server { | |
listen 3333; | |
server_name #domain name; | |
root /usr/local/rails_apps/project_name/current/public; | |
access_log /usr/local/rails_apps/project_name/current/log/nginx_access.log; | |
error_log /usr/local/rails_apps/project_name/current/log/nginx_error.log; | |
try_files $uri/index.html $uri @app; | |
location / { | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $host; | |
proxy_redirect off; | |
proxy_set_header Connection ''; | |
proxy_pass http://app; | |
proxy_http_version 1.1; | |
} | |
location ~ ^/(assets|fonts|system)/|favicon.ico|robots.txt { | |
gzip_static on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
client_max_body_size 4G; | |
keepalive_timeout 10; | |
} |
This file contains hidden or 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 static resource | |
server { | |
listen 80; | |
server_name 212.83.163.175; | |
server_name #domain name; | |
root /home/deploy/app/dist; | |
access_log /home/deploy/app/logs/nginx_access.log; | |
error_log /home/deploy/app/logs/nginx_error.log; | |
try_files $uri $uri/ /index.html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment