mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
Apache2 Configuration Sample
Sample Virtualhost showing how to:proxy requests to thinserver cluster, Server static files locally, set headers for downstream server to cache static assets, exclude mod_security rules that interfere with Discourse.
This commit is contained in:
parent
a8c44d90a3
commit
ff4aaa04cb
1 changed files with 49 additions and 0 deletions
49
config/apache2.conf.sample
Normal file
49
config/apache2.conf.sample
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# Apache2 Virtual Host file to proxy Discourse to Thin cluster
|
||||||
|
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerName forum.example.org.uk
|
||||||
|
DocumentRoot /html/discourse/public/
|
||||||
|
LogLevel debug
|
||||||
|
# ErrorLog /html/discourse/log/error.log
|
||||||
|
# CustomLog /html/discourse/log/access.log combined
|
||||||
|
|
||||||
|
# Hide some server information, since we can..
|
||||||
|
Header set Server "Sample Server Name"
|
||||||
|
|
||||||
|
<IfModule mod_security2.c>
|
||||||
|
SecRuleEngine On
|
||||||
|
# Remove any rules that prevent Discourse from running at all
|
||||||
|
SecRuleRemoveById <rule id>
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<Directory /html/discourse/public/>
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<LocationMatch "^/assets/.*$">
|
||||||
|
# Set caching headers here, providing advice to downstream cache
|
||||||
|
Header set Cache-Control "public, max-age = 604800"
|
||||||
|
</LocationMatch>
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
<Proxy balancer://thinservers>
|
||||||
|
BalancerMember http://127.0.0.1:3000
|
||||||
|
BalancerMember http://127.0.0.1:3001
|
||||||
|
BalancerMember http://127.0.0.1:3002
|
||||||
|
</Proxy>
|
||||||
|
|
||||||
|
# Prevent requests for /assets from being passed upstream
|
||||||
|
ProxyPass /assets !
|
||||||
|
|
||||||
|
# Pass the everything else
|
||||||
|
ProxyPass / balancer://thinservers/
|
||||||
|
ProxyPassReverse / balancer://thinservers/
|
||||||
|
ProxyPreserveHost on
|
||||||
|
|
||||||
|
<Proxy *>
|
||||||
|
Require all granted
|
||||||
|
</Proxy>
|
||||||
|
|
||||||
|
</VirtualHost>
|
||||||
|
|
Loading…
Reference in a new issue