The title is quite self explanatory, I was wondering if there’s any way to access the public folder in /var/www/discourse/public
outside of Docker so I can easily copy files in and out to the host filesystem?
Sure, have a look in /var/discourse/shared/standalone
.
The public
folder itself is not stored there, but e.g. the compiled assets and uploaded pictures; these directories are symlinked into Discourse’s public
folder.
If your goal is to serve static content, do not store it in the public folder as that folder is under source control and your files would be destroyed when the container is rebuilt.
@elberet Thanks for the quick response, if one were to want to serve some static content, then where would be the correct place for that? (some static HTML and javascript)
I don’t know how you want to serve the static HTML and Javascript. You can upload them in your Assets for site
.
If you want to serve images for your Discourse site, simply upload them as attachments in any post. By default, Discourse has a restricted staff category that is ideal for this purpose. CSS and JavaScripts can be entered as customizations in the admin interface.
However, these images’ URLs won’t be very readable, so if you want to serve anything under a specific filename or upload full HTML pages, that’s going to be a problem as Discourse currently has no means to host “foreign” content. As I mentioned, you will want to run your own frontend webserver and route requests either to your own content or to the Discourse container as needed. For Apache, something like this could work, assuming that you’ve changed your Discourse container definition to map port 4000 to internal port 80:
<Proxy balancer://discourse>
BalancerMember http://localhost:4000
</Proxy>
Alias /static/ "/home/website/htdocs/"
<Directory "/home/website/htdocs">
Require all granted
</Directory>
RewriteEngine on
RewriteRule ^/static$ /static/ [R=301,L]
RewriteRule ^/static/(.*)$ /static/$1 [PT,L]
RewriteRule ^/(.*)$ balancer://discourse%{REQUEST_URI} [P,QSA,L]
Of course, running another webserver isn’t free, least of all in terms of time invested into its configuration, but the slight advantage is that you can now not only serve static content but also other applications such as PHP scripts.
Just to check, you have Apache set up to handle long polling nicely, right? I think its design doesn’t really like long polling.
Yes, we’ve been over this before…
Use the evented MPM, apply some tuning (mostly crank up AsyncRequestWorkerFactor
) and you’re good to go.
Can you kindly clarify how does we have access to such Apache file?
And which URL we would get?
It’s kind of weird having a VPS and not having access to a normal public folder.