Welcome! Log In Create A New Profile

Advanced

serving css, js, sag etc.. with nginx instead of express static

Posted by qafwaf 
serving css, js, sag etc.. with nginx instead of express static
January 17, 2023 01:54PM
I'm seperating my client side from server side, my client side will build a public folder with webpack and the server side using express with pug template engine, inside the public folder there is my css and js files i was able to use express.static to reference this folder, however I'm trying to serve this folder with nginx but i'm struggling to do this, all i need to be able to reference those files inside my server views folder

client
public
css
main.css
js
main.js
Dockerfile

server
views
index.pug
index.js
Dockerfile

nginx
Dockerfile
default.conf

nginx config
upstream client {
server client:3000;
}

upstream api {
server api:5000;
}

server {
listen 80 default_server;
server_name _;

location / {
proxy_pass http://client;
}
location /sockjs-node {
proxy_pass http://client;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}

location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://api;
}
}

i want to be able to reference the public folder inside client in my server folder i tried /plublic/css/main.css /css/main.css not working
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 120
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready