Created
December 14, 2025 21:57
-
-
Save dottwatson/299fedfa74b8fa131d0366888291f4cd to your computer and use it in GitHub Desktop.
enable Laravel Vite in HestiaCP with Apache2 + Proxy Nginx , over HTTPS and VsCode connected in SSH
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
| Step 1 | |
| open your nginx file in /home/%user%/conf/web/application.o%domain%/nginx.ssl.conf | |
| and comment line | |
| proxy_hide_header Upgrade; | |
| Step 2 | |
| Creta the file /home/%user%/conf/web/%domain%/nginx.ssl.conf_vite and paste this code | |
| ## | |
| # VITE DEV SERVER (Laravel + Vite + HMR) | |
| # HTTPS + WSS - HestiaCP compatible | |
| ## | |
| # -------------------------------------------------- | |
| # Vite HMR websocket (path ESATTO) | |
| # -------------------------------------------------- | |
| location = /@vite { | |
| proxy_pass http://127.0.0.1:5173; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| proxy_set_header Host $host; | |
| proxy_buffering off; | |
| proxy_redirect off; | |
| } | |
| # -------------------------------------------------- | |
| # Vite client / env / assets | |
| # -------------------------------------------------- | |
| location ^~ /@vite/ { | |
| proxy_pass http://127.0.0.1:5173; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| proxy_set_header Host $host; | |
| proxy_buffering off; | |
| proxy_redirect off; | |
| } | |
| # -------------------------------------------------- | |
| # Dev JS / CSS | |
| # -------------------------------------------------- | |
| location ^~ /resources/ { | |
| proxy_pass http://127.0.0.1:5173; | |
| proxy_set_header Host $host; | |
| proxy_redirect off; | |
| } | |
| # -------------------------------------------------- | |
| # Vite internal modules | |
| # -------------------------------------------------- | |
| location ^~ /node_modules/ { | |
| proxy_pass http://127.0.0.1:5173; | |
| proxy_set_header Host $host; | |
| proxy_redirect off; | |
| } | |
| then save it and in terminal | |
| nginx -t && systemctl reload nginx | |
| Step 3 | |
| use a vite.config.js like this (the very important part is the server part) | |
| import { defineConfig } from 'vite'; | |
| import laravel from 'laravel-vite-plugin'; | |
| import tailwindcss from '@tailwindcss/vite'; | |
| export default defineConfig({ | |
| server: { | |
| host: '0.0.0.0', | |
| port: 5173, | |
| origin: 'https://my.awesome.domain.ltd', | |
| hmr: { | |
| protocol: 'wss', | |
| host: 'my.awesome.domain.ltd', | |
| clientPort: 443, | |
| path: '/@vite', | |
| }, | |
| }, | |
| plugins: [ | |
| laravel({ | |
| input: ['resources/js/app.js'], | |
| refresh: true, | |
| }), | |
| tailwindcss(), | |
| ], | |
| }); | |
| Thats it! | |
| Enjoy vite! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment