Skip to content

Instantly share code, notes, and snippets.

@jamesallan93
Last active May 29, 2022 01:29
Show Gist options
  • Select an option

  • Save jamesallan93/a448cd7e418a589ce4067ba96018d715 to your computer and use it in GitHub Desktop.

Select an option

Save jamesallan93/a448cd7e418a589ce4067ba96018d715 to your computer and use it in GitHub Desktop.
Nginx settings for nuxt3, you can use ssl in localhost with it. Don't forget to add you ssl .pem and .key to nginx
server {
listen 80;
listen 443 ssl;
server_name dev.domainname.pl;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types
application/atom+xml
application/geo+json
application/javascript
application/x-javascript
application/json
application/ld+json
application/manifest+json
application/rdf+xml
application/rss+xml
application/xhtml+xml
application/xml
font/eot
font/otf
font/ttf
image/svg+xml
text/css
text/javascript
text/plain
text/xml;
# This is a cache for SSL connections
# ssl_session_cache shared:le_nginx_SSL:1m;
# ssl_session_timeout 1440m;
rewrite ^/(.*) /$1 break;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering on;
proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_pass http://localhost:3000;
proxy_read_timeout 1m;
proxy_connect_timeout 1m;
}
location /_nuxt/hmr/ {
proxy_pass http://localhost:24678;
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;
}
}
In nuxt.config.ts
add ...
vite: {
server: {
hmr: {
clientPort: 443,
path: "hmr/",
protocol: "wss",
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment