Can I use Discourse in a LAMP Server Stack?

(Charles Wilmott) #1

I’m using digital ocean droplet.
I have LAMP already install on a dropel.

To keep my hosting costs down.
Can install discourse on the same droplet?

Many thanks for your help

(Bill Ayakatubby) #2

No. Other than Linux, Discourse uses a completely different set of technologies. Instead of Apache, MySQL, and PHP, it uses Nginx, Ruby, PostgreSQL.

(Ben T) #3

Agreed. You could install discourse alongside your LAMP stack (in the same droplet), but it won’t be easy to maintain and requires some knowledge of how Apache works. It will be much easier if you use a seperate droplet/vps.

There is a way to define a virtual host that is similar to proxy_pass for nginx, but I don’t know much about it. It has the same name though! This might be a good explanation, but that’s where my knowledge ends. It’d replace the third step from what I wrote previously.

(Jens Maier) #4

Depending on your requirements, setting up Apache as a reverse proxy to replace nginx isn’t too hard:

<VirtualHost *:80>
    CustomLog ...
    ErrorLog ...
    ServerName ...

    DocumentRoot /path/to/discourse/public
    UserDir disabled
    DirectoryIndex disabled

    <Directory "/path/to/discourse/public">
        AllowOverride None
        Require all granted

    RewriteEngine on
    RewriteRule ^/(.*)${REQUEST_URI} [P,QSA,L]

This assumes name-based virtual hosting and that mod_proxy and mod_rewrite are installed. Set up your docker so that it exposes the Rails server – I think this was already asked and answered elsewhere in this forum – and adjust the RewriteRule accordingly.

(Kane York) #5

I seem to remember that Apache can’t handle long polling, at all, or something.

So, if live updates don’t work right away, go to your site settings and uncheck enable_long_polling:


I am of the opinion that this will severely gimp your site, however. Expect pain and problems.

(Jens Maier) #6

What about Apache 2.4 with the event MPM?

(Michael Howell) #8

You don’t need a second VPS. It’s just easier that way.