Running other websites on the same machine as Discourse

If I’m not mistaken your app.yml is generated after you have successfully bootstrapped.

You may have to stop your running webserver (apache/nginx/whatever) until discourse is installed and you have modified app.yml to use either an alternative port or an alternative method e.g. sockets to make your forum run behind a proxy i.e. your webserver.

2 Likes

The app.yml is generated during discourse-setup - you can bootstrap/rebuild separately by following the old Docker install instructions.

3 Likes

From the official installation guide, on the /discourse-setup part:

This will generate an app.yml configuration file on your behalf, and then kicks off bootstrap.

And I can’t go past the ./discourse-setup part since the installation stops because of the port thing.

I’ll try to stop my webserver as you suggest.

Just stop the webserver beforehand and complete the ./discourse-setup script. You’ll have an app.yml file in the containers folder when the script completes successfully.

2 Likes

Yes I stopped apache and nginx and the install is working, thanks guys. :slight_smile:

1 Like

Well I then followed the steps on this thread and:
from /var/discourse/containers/app.yml,
- "templates/cron.template.yml" > I didn’t have this line and I didn’t add it since this guide doesn’t tell to add it.

Then the guide tells:

# expose: comment out entire section

And then

Be sure to remove the next line containing

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

So, should I remove nor comment this line since it is from the # expose section? I commented it by the way.

For an HTTPS site, make /etc/nginx/sites-enabled/discourse.conf look like this:

I didn’t have such a file and I created it. Is the file supposed to be already here after installing Discourse, or is it normal that I had to create it?

Then I followed the remaining steps and I didn’t forget to restart nginx, but my Discourse installation doesn’t show up (I created my subdomain from Plesk):

Finally, I see that this guide mention:

This guide assumes you already have Discourse working

But what if we don’t have Discourse working, especially because we already have other web apps running? Is there another guide intended for this configuration?

1 Like

Try searching for “offline page while rebuilding” guide here on meta and observe it’s nginx configuration.

1 Like

Thank you. I don’t have any error message of any kind, my subdomain just shows up the default home page for any new subdomain created from plesk.

That is because it can’t reach discourse which is trapped inside docker until you show it the way to interact with outside world.

1 Like

Hi, I started back from the beginning and I have Discourse working now :slight_smile:; I just need to read and apply this guide again, but still, I have quick questions before doing so. I don’t want to mess up.
I don’t have the /etc/nginx/sites-enabled/discourse.conf file. Is it supposed to be that way and do I have to create it?
Also the -templates/cron.template.yml" line in app.yml file which I don’t know if I have to add it or not since it’s not present in my own config file.

Yes

If it’s not there and you don’t know the use of it then don’t bother about it.

1 Like

Thank you again for your reply.

From what I see, the /sites-enabled/ directory is not included in my nginx.conf. However, this file contains :

include /etc/nginx/conf.d/*.conf;

So I created a discourse.conf file in this /conf.d/ directory. My discourse.conf contains among other lines these copy-pasted from the guide:

    ssl_certificate      /var/discourse/shared/standalone/ssl/ssl.crt;
    ssl_certificate_key  /var/discourse/shared/standalone/ssl/ssl.key;
    ssl_dhparam          /var/discourse/shared/standalone/ssl/dhparams.pem;

nginx tells me that these files don’t exist.
I replaced ssl.crt by forum.canapin.com.cer and ssl.key by forum.canapin.com.key as I these ones exist. But I can’t find any dhparams.pem.

Any idea?

If you’ve installed letsencrypt certificate then dhparams.pem should be generated in your working directory /etc/letsencrypt you can copy it from there.

3 Likes

Thank you, I’ve been able to get this file.

I think I’m very close to having Discourse working :slight_smile: I had no error message whatsoever which is a new thing compared to my previous config attempts and I’ve been able to start the app after making all this configuration.

However, forum.canapin.com still shows the default page generated by Plesk.

So I guess I’m missing a little something somewhere…

1 Like

Hmm … That sums it down. You may have to stop nginx from proxying requests for forum.canapin.com to apache2 and rather proxy them to the socket instead.

I’d hint on modifying the default nginx config (the other config in the conf.d folder) to be domain agnostic and specifically not handle requests for forum.canapin.com subdomain.

1 Like

Hi,

I thought that’s what the checkbox unchecked would do since it mentions “turn off to stop using Apache”.
The only other files that I have in my conf.d folder are ssl.conf and zz010_psa_nginx.conf, the latter containing:

#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
include /etc/nginx/plesk.conf.d/server.conf;
include /etc/nginx/plesk.conf.d/webmails/*.conf;
include /etc/nginx/plesk.conf.d/vhosts/*.conf;
include /etc/nginx/plesk.conf.d/forwarding/*.conf;
include /etc/nginx/plesk.conf.d/wildcards/*.conf;

I’m not a plesk user so I don’t know much details about how it handles request but if nginx is responsible for everything after that checkbox is unchecked then it should definitely read the discourse.conf but looks like it’s not reading that.

I’ve gone through your configurations and both look okay so I don’t have much to say. I’d like to know if you have some way to alter configurations inside of your plesk panel. if so, try to edit the configuration from there.

1 Like

Thanks again for your reply. :slight_smile:

Well, I think nginx reads my discourse.conf since it threw an error when this .conf was referring to inexisting files. But it doesn’t seem to redirect for some reason.

I’ll keep searching…

I think the opposite! because the file seems configured correctly and I don’t see a reason for it not to resolve back to discourse.

Hi, I indeed had to do some more stuff found on Installing Discourse With Plesk Onyx (Ubuntu 14.04) I guess. I edited my app.yml to uncomment the two lines from expose and changed the ports to check from 80 to 8060 and 443 to 9443.
Then I added these rules in Plesk:
image

Now I have a 502 bad gateway error.