Discourse not working on Apache + Passenger in sub-directory

(qxqp) #1

Hi, now I’m trying to install Discourse on Apache + Pasenger. But it doesn’t work in sub-directory … Could you please give some advice ?


  • CentOS (6.4) + Apache (2.2.15) + Passenger (3.0.19)
  • Discourse : master on GitHub


  • Already runnning Redmine on the passenger at a sub-directory (/redmine). It’s running normally.
  • Try to running Discourse on the same passenger instance at a sub-directory (/discourse).
  • I can get static files of Discourse like /discourse/assets/admin.css, etc normally.
  • However.I got 404 when try to access index of Discourse (/discourse). I assume that Discourse does not handle any requeest.
  • Seems running Discourse on Passenger. There are 2 rails apps (redmine, discourse) on passenger-status.
  • There aren’t any errors on /var/log/httpd/error_log (except favicon.ico).
  • I can run Discourse app by bundle exec rails s -p 9999 -e production. There aren’t any problems.
  • I’ve precompiled assets by bundle exec rake assets:precompile RAILS_ENV=production.


This is my VirtualHost settings @ httpd.conf. I made symbolic links @ /var/www/html/ to public directory of Rails apps (Redmine / Discourse).

NameVirtualHost *:80
<VirtualHost *:80>
  ServerName 172.xx.xx.xx
  DocumentRoot /var/www/html
  RackBaseURI /redmine
  <Directory /var/www/html/redmine>
    Options FollowSymLinks
    Options -MultiViews
    AllowOverride All
    Order Allow,Deny
    Allow From All
  RackBaseURI /discourse
  <Directory /var/www/html/discourse>
    Options FollowSymLinks
    Options -MultiViews
    AllowOverride All
    Order Allow,Deny
    Allow From All


Results of passenger-status are following.

----------- General information -----------
max      = 20
count    = 2
active   = 0
inactive = 2
Waiting on global queue: 0

----------- Application groups -----------
  App root: /opt/www/discourse
  * PID: 3528    Sessions: 0    Processed: 4       Uptime: 25m 11s

  App root: /opt/www/redmine
  * PID: 30335   Sessions: 0    Processed: 319     Uptime: 5h 27m 49s

I’m not sure why is Discourse not running … could you please give some advice ?

(qxqp) #2

Does anyone know about this ?

(Sam Saffron) #3

Running discourse in a sub-uri eg: mysite/discourse is something that is very tricky and undocumented.

I would have to read through the source to figure this out and am not sure all of the bugs have been ironed out.

Would strongly recommend running Discourse at the top level until this feature is properly tested and documented.

(qxqp) #4

Thanks sam.
I understand that you don’ t recommend running discourse on sub-directory. I’ll go find another products …

(Jeff Atwood) #5

In theory running Discourse in a subfolder can work, it is a largely untested configuration.

It is better to run as forum.example.com rather than www.example.com/forum whenever possible, just because the subfolder config is not nearly as common and we don’t run any of our sites that way.

(deweydb) #6

Has any progress been made on this since the requests? i see several requests for this feature from about 1 year ago. Personally i would really love to have it setup this way.

(Jeff Atwood) #7

Running in a subfolder is still largely an unsupported configuration. We still do not run any sites this way, and see no real demand for it from customers, so you are likely to run into a ton of bugs and edge conditions.

(deweydb) #8

Ok, well it looks like i will be somewhat of a beta tester in uncharted waters. I definitely need it to be in a sub folder as i plan on extending discourse into something bigger for my needs (news feed on /, ecommerce at /store, etc). Ideally i would like user sessions to persist between discourse and other areas of the site (e.g. /store), and i’m pretty sure if i put discourse at a subdomain i would run into all sorts of cross domain scripting pain that i would like to avoid.

I would appreciate any advice that you can give as to where you think bugs might arise, or issues that come to mind.


I have discourse in subdomain.domain.crot (source of application in subdirectory), but all url of assets has multiple slashes. Can you tell me some reference to fix this issue?