Last active
January 6, 2024 01:24
-
-
Save efthemiosprime/799382c37308af4a7705f86208c6f2ec to your computer and use it in GitHub Desktop.
nginx config file for Nextjs App
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
#place in /etc/nginx/sites-available/name_of_config_file | |
server { | |
listen 80; | |
server_name staging.mna.co; | |
gzip on; | |
gzip_proxied any; | |
gzip_types application/javascript application/x-javascript text/css text/javascript; | |
gzip_comp_level 5; | |
gzip_buffers 16 8k; | |
gzip_min_length 256; | |
location /_next/static/ { | |
alias /home/mna/mnaco-cms/frontend; | |
expires 365d; | |
access_log off; | |
} | |
location / { | |
proxy_pass http://127.0.0.1:3000; #change to 3001 for second app, but make sure second nextjs app starts on new port in packages.json "start": "next start -p 3001", | |
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment