Attempting to install Discourse on private Apache Server

Hello Discourse community,

I am a part of a game development team, and we’ve been looking for a better, more modern forum platform to our current phpBB forums. And I believe Discourse is it!

Unfortunately, our Webhost does not allow for root access, meaning we can’t install Discourse to it (at least, that’s what I’ve read and our lead site admin tells me). Fortunately, I do have an Ubuntu box that I want to turn into an Apache Server (the first time I’ve ever tried to set one up), and I would like to host Discourse on it. We’re a small enough team, that I don’t think there will be a traffic issue.

Discourse has been proving very difficult to set up (as per the above, I’m new to installing an Apache Server in general). All the instructions I can find are in regard to installing Discourse on DigitalOcean. I’ve been trying to follow all the steps in this particular article, but have run into several problems:

  1. I can’t get SMTP to send an email. Of course, this is a problem related to setting up SMTP (and again, something I’m completely new to).
  2. As mentioned above, I’d like to host Discourse on my personal server, as opposed to Cloud hosting like DigitalOcean. So I haven’t been able to set up Droplet.

I imagine #2 is my main issue as to why I haven’t been able to get Discourse to show on my server (I got the successful Apache page to show, as well as PHP). Is it even possible to host Discourse on a personal server? The only instructions seem to be in regard to hosting on DigitalOcean.

Can anyone here help a newbie out? Keep in mind I do have a basic understanding of Linux (particularly Ubuntu distros).

1 Like

When I installed Discourse on a “personal” server, I used the Docker image and it worked. Installing Apache / PHP is not the way to go for the standard Docker install.

3 Likes

The official installation documentation (accept no substitutes!) describes how to create a DigitalOcean droplet simply because that is the quickest and cheapest way to get a VPS, if you don’t have one already – and as a bonus, it comes in a known-good state. The rest of the guide is in no way DigitalOcean-specific, and if you skip the “create a droplet” steps, the rest of the steps will work on any other compatible machine.

If you’re having problems getting Discourse working on your own machine, you should try a test install on a DigitalOcean droplet first, following the instructions exactly, and making sure that works. Once you do that, then you can compare your setup against the DigitalOcean one and figure out how you need to do things differently on your system to make everything work.

IIRC, the coupon code ALLSSD10 gets you some DigitalOcean credit, so your testing doesn’t necessarily have to cost you anything.

10 Likes

You don’t need apache. Follow the install guide that is suggested above. It will work fin on your ubuntu server if you heave not installed apache.

I promise that you don’t want to run your own mail server.

3 Likes

Thanks for the posts.

UPDATE:
Still getting “Server Not Found” when I go to the URL discourse.[my_hostname] (the Hostname I want my Discourse to be). I’m thinking the issue might be an issue with one of the two:

  1. The DNS: “Once bootstrapping is complete, your Discourse should be accessible in your web browser via the domain name discourse.example.com you entered earlier, provided you configured DNS.” I tried setting up DNS via this article: Dnsmasq - Community Help Wiki (where I have "search=[my_hostname] in /etc/resolv.conf).
  2. The Webmail server: I was talking with a friend of mine, and he says the webmail URL should work as a Mail Server, so I’ve put that in when the Discourse Install asks for an SMTP server address. As the SMTP username and password, I put an admin email account (with its correct password). Maybe something needs to be done on the Mail Server to allow Discourse to work with it?

Eli the Bearded: Can you explain to me what a Docker image is? I installed it as per this guide: https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md

Matt Palmer: I suppose I could try that method, but I don’t see how it will help much with getting DIscourse to run from my home Ubuntu machine.

Jay Pfaffman: Well, I am trying to follow that install guide, but obviously it’s built around installing Discourse on the Cloud. I wish they had one for building Discourse on a home server, but hey, that’s life.

The install cloud directions will work on any Ubuntu server.

If you really mean a webmail URL, and not the hostname of an smtp server, your friend is wrong. There is an email troubleshooting document with more information.

If you followed he install cloud docs on your own Linux workstation, you should be able to access your Discourse at http://localhost .

If you want your server to be accessible from other computers, you have to do some router configuration, which is beyond the kind of support you are likely to get here.

3 Likes

Ok, so not the Webmail URL itself. I checked with my friend again, and he suggested our actual cloud host’s URL of our team’s website (cloud18.unlimitedwebhosting).

However, even after putting in this as the SMTP address and one of our website’s email addresses and credentials … no luck. Still “Server Not Found” when I try “discourse.[my_hostname]” or “discourse.localhost” in a browser. I think at this point, it’s probably best I just list out some of what’s in my app.yml file that I’ve been modifying manually:

Line 23: Changed http “80:80” to “10080:10080” (since I was getting an error before about 80 being in use, and one of the guides I read suggested to change to an unused port)

Line 48: DISCOURSE_HOSTNAME: discourse.nexus-matt.org
(my computer’s hostname is “nexus-matt.org”. When I type this or “localhost” into a browser, I get the “Apache2 Ubuntu Default Page” (since I’ve installed Apache on this machine), meaning that my hostname is recognized.)

Line 56: DISCOURSE_DEVELOPER_EMAILS: ‘postmaster@discourse.nexus-matt.org’
(I figure I can put any email address here, right? Could I use an email from our team’s webmail as a DIscourse Developer Email, or does is have to be a part of my local hostname domain?)

Lines 59-62:
DISCOURSE_SMTP_ADDRESS: cloud18.unlimitedwebhosting.co.uk
DISCOURSE_SMTP_PORT: 465
DISCOURSE_SMTP_USER_NAME: admin@[our_UnlimitedWebhosting_web_domain].co.uk
DISCOURSE_SMTP_PASSWORD: “[obviously_not_revealing]”
(Port 465 was what my friend suggested, for smtp-ssl)

I have not modified anything else in app.yml. I’ve followed everything (except the Cloud Hosting instructions) in this link: https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md
Well, I also haven’t added “valid SPF and DKIM records in your DNS. See your mail provider instructions for specifics”, but would that actually effect Discourse not showing up on my machine?

And yes, I’m well aware that routing configuration will not be covered on this forum. I just want to get Discourse up and running locally on my machine right now.

Also, is there any kind of error log that the Discourse laucher generates?

If you want yourdomain.com to point to your server, you need to update your DNS records with your registrar (unless you’ve delegated DNS to some other servers). This has nothing to do with Discourse.

When you mention people in Discourse, if you want them to know that you mentioned them, you type an @ and then their username, like @naupe.

If you want to install Discourse and Apache (and you have said nothing that implies that you do), you should follow these instructions. But, really, you should remove or disable Apache.

No. See the instructions I linked to or remove Apache. (Something like 1080:80 would be closer to what you are trying to do, but that’s not what you want to do.)

My advice:

sudo su -
apt purge apache
cd /var/discourse
rm containers/app.yml
./discourse-setup

Answer the questions. Don’t enable let’s encrypt. If http://nexus-matt.org is pointing to your Apache server, use that domain name for Discourse.

If your mail config doesn’t work, which seems likely to be your next problem, you can create an account like this:

sudo su - 
cd /var/discourse
./launcher enter app
rake admin:create

BTW, the two major hosting services have free trials. For $0.36/day you can try it out on Digital Ocean. If you use a referral link (there’s one on my site), you’ll get a $10 credit on Digital Ocean, so you’ll get your first month free.

3 Likes