Can't make Discourse accessible through Apache


#1

Hi, guys!

I’m a complete noob, so I apologize in advance for any stupid question.

I’m trying to install Discourse in my Digital Ocean LAMP Ubuntu Droplet.

I tried the instructions (and the tips here Discourse on Ubuntu 14.04) and could finally install it. It was returning an error, so I changed app.yml in order to:

expose:
  - "80:80"   # fwd host port 80   to container port 80 (http)

But there’s an issue.

My app.yml has:

DISCOURSE_HOSTNAME: ‘forum.mysite.com

But I can’t access Discourse when I try that address. But, if I try mysite.com:8080, it opens ok.

So, my question is: what should I do?

I guess this is more of a Apache thing than of a Discourse issue, so I apologize if that’s the case

Thanks!


(Khoa Nguyen) #2

Did you rebuild your docker image after change app.yml?


(Jens Maier) #3

This question has been asked quite a number of times already…

Basically, only one process can listen to a port, and there’s only a single port for incoming HTTP traffic. This means it’s impossible to run two webservers alongside each other, instead you must configure at least one of them to proxy requests through to the other. Since you have manual control over the Apache running on the host, that’s what you’ll need to work with.

I’ve posted my Apache config here and there’s also a discussion on how to set up Apache so that it can handle long polling. (You MUST use the evented MPM or performance will be terribad!)


(See also this snippet that shows how to overlay something over Discourse’s namespace via the Apache frontend.)


#4

That sounds complicated :persevere:

I’ll try figuring it out.

So I should keep

expose:

  • “80:80”

at my app.yml?

Because, if I do, I can’t even start the app.


(Michael Downey) #5

What specifically is failing when you try to access it? Does the browser return an error message? If so, what is it?

Did you set up a DNS entry for forum.example.com pointed to the correct IP address?


#6

It was failing, but now I created a forum.mysite.com.conf file with the following content:

<VirtualHost *:80>

    ServerName forum.mysite.com
    ServerAdmin my@gmail.com


    DocumentRoot /var/www/mysite.com/public_html/forum


    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/www/mysite.com/public_html/forum>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
    </Directory>

            ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

It’s now getting me to apache’s default html message, which is at /var/www/html/

I’m not sure why


(Jens Maier) #7

No, you should expose "127.0.0.1:4000:80", then use the config snippet I’ve linked to and proxy into the container.

Let me repeat: you can not run Discourse on port 80 while another webserver is running on your host system. It’s simply not possible.

As for Apache’s default page appearing, did you wrap that block in a <VirtualHost> block? For Apache 2.2: did you enable name-based virtual hosting?

Also, and I cannot stress this enough, if you’re going to be a server admin, you should understand what you’re doing or you’re going to put yourself and your users at risk. Be responsible and RTFM. (Read The F…riendly Manual)


(Kane York) #8

Yes. @souljacker, you most likely will have the best experience following this topic:


(Régis Hanol) #9