admin管理员组

文章数量:1406154

I have an apache server that is reachable from outside my local network, named interfaceserver.

I also have an express server in my local network, named localserver.

In apache configuration of interfaceserver, I am proxying routes starting with foo to localserver, with the following lines in the conf:

ProxyPass "/foo" "http://localserver:8001/foo"
ProxyPassReverse "/foo" "http://localserver:8001/foo"

localserver is serving static files in his public directory. This is the architecture of localserver:

/srv/localserver
├── public # folder containing static files
├── routes # folder containing routes
├── app.js

In app.js, I am serving static files with:

app.use(express.static("public"));

Static files are served well when I am accessing http://localserver:8001/foo, but they are not served at all when accessing via , error 404.

I can't store the static files in interfaceserver.

I am using the static files in my ejs file. For example:

<link href="/css/main.css" rel="stylesheet" type="text/css">

本文标签: nodejsserving static files with a proxy serverStack Overflow