# Installing Discourse with Apache2 Installed

**URL:** https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [July 21, 2021, 4:02pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771 "2021-07-21T16:02:34Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 4:02pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/1 "2021-07-21T16:02:34Z")

</div>

Hi!  
I am running an Ubuntu 18.04 server with Apache installed. I am wanting to install Discourse on a different port then use a reverse proxy via apache to make it accessible via a URL. I tried making an app.yml & changing the settings in there then ran: ./launcher rebuild app and everything goes well until the end where I get a ‘Failed’ error with this:

> ## FAILED
> 
> Pups::ExecError: cd /var/www/discourse && su discourse -c ‘bundle exec rake themes:update assets:precompile’ failed w ith return #\<Process::Status: pid 3801 exit 134\>  
> Location of failure: /pups/lib/pups/exec\_command.rb:112:in `spawn’  
> exec failed with the params {“cd”=\>“$home”, “hook”=\>“assets\_precompile”, “cmd”=\>[“su discourse -c ‘bundle exec rake t hemes:update assets:precompile’”]}  
> 2beda643ff51279f145c96cdede83a1d6b65f67e00225be74100c8fb9fe3f790  
> \*\* FAILED TO BOOTSTRAP \*\* please scroll up and look for earlier error messages, there may be more than one.  
> ./discourse-doctor may help diagnose the problem.

I tried using discourse-doctor but this told me nothing. Does anyone have a way to fix this? Also, I am using Apache as I find it easier to use and have more experience with Apache. So switching to Nginx isn’t an option.  
**Here is some logs from above the failed section:**

> MaxMind IP database updates require a license  
> Please set DISCOURSE\_MAXMIND\_LICENSE\_KEY to one you generated at [https://www.maxmind.com](https://www.maxmind.com)  
> MaxMind IP database updates require a license  
> Please set DISCOURSE\_MAXMIND\_LICENSE\_KEY to one you generated at [https://www.maxmind.com](https://www.maxmind.com)  
> 98765.375844045 Compressing: vendor-9297d3b5d396b76cde3e1a19c960cf10c5edf8be99b1f5aeff21012e3ae57a34.js  
> terser ‘/var/www/discourse/public/assets/\_vendor-9297d3b5d396b76cde3e1a19c960cf10c5edf8be99b1f5aeff21012e3ae57a34.js’ -m -c -o ‘/var/www/discourse/public/assets/vendor-9297d3b5d396b76cde3e1a19c960cf10c5edf8be99b1f5aeff21012e3ae57a34.js’ --source-map “base=‘/var/www/discourse/public/assets’,root=‘/assets’,url=‘/assets/vendor-9297d3b5d396b76cde3e1a19c960cf10c5edf8be99b1f5aeff21012e3ae57a34.js.map’”  
> \<— Last few GCs —\>
> 
> [3798:0x4872980] 2679 ms: Scavenge 108.1 (126.5) → 97.8 (129.8) MB, 9.0 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure  
> [3798:0x4872980] 2823 ms: Scavenge 111.4 (129.8) → 101.3 (132.8) MB, 8.4 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure  
> [3798:0x4872980] 2964 ms: Scavenge 114.8 (133.0) → 104.8 (135.3) MB, 32.7 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
> 
> \<— JS stacktrace —\>
> 
> FATAL ERROR: NewSpace::Rebalance Allocation failed - JavaScript heap out of memory  
> 1: 0xa89e60 node::Abort() [node]  
> 2: 0x9ade29 node::FatalError(char const\*, char const\*) [node]  
> 3: 0xc7583e v8::Utils::ReportOOMFailure(v8::internal::Isolate\*, char const\*, bool) [node]  
> 4: 0xc75bb7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate\*, char const\*, bool) [node]  
> 5: 0xe3f6d5 [node]  
> 6: 0xe7ec67 [node]  
> 7: 0xe90b11 v8::internal::MarkCompactCollector::CollectGarbage() [node]  
> 8: 0xe4c9d8 v8::internal::Heap::MarkCompact() [node]  
> 9: 0xe4e368 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]  
> 10: 0xe5190c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]  
> 11: 0xe157da v8::internal:🏭:NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]  
> 12: 0x116d5e8 v8::internal::Runtime\_AllocateInOldGeneration(int, unsigned long\*, v8::internal::Isolate\*) [node]  
> 13: 0x15045f9 [node]  
> Aborted (core dumped)  
> rake aborted!  
> Errno::ENOENT: No such file or directory @ rb\_file\_s\_size - /var/www/discourse/public/assets/vendor-9297d3b5d396b76cde3e1a19c960cf10c5edf8be99b1f5aeff21012e3ae57a34.js  
> /var/www/discourse/lib/tasks/assets.rake:293:in `size' /var/www/discourse/lib/tasks/assets.rake:293:in `block (4 levels) in ’  
> /var/www/discourse/lib/tasks/assets.rake:182:in `block in concurrent?' /var/www/discourse/lib/tasks/assets.rake:284:in `block (3 levels) in ’  
> /var/www/discourse/lib/tasks/assets.rake:273:in `each' /var/www/discourse/lib/tasks/assets.rake:273:in `block (2 levels) in ’  
> /var/www/discourse/lib/tasks/assets.rake:182:in `concurrent?' /var/www/discourse/lib/tasks/assets.rake:270:in `block in ’  
> /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>' /usr/local/bin/bundle:23:in `load’  
> /usr/local/bin/bundle:23:in `’  
> Tasks: TOP =\> assets:precompile  
> (See full trace by running task with --trace)  
> I, [2021-07-21T16:25:26.467914 #1] INFO – : Downloading MaxMindDB…  
> Compressing Javascript and Generating Source Maps
> 
> I, [2021-07-21T16:25:26.469702 #1] INFO – : Terminating async processes  
> I, [2021-07-21T16:25:26.469947 #1] INFO – : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 56  
> I, [2021-07-21T16:25:26.470157 #1] INFO – : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 174  
> 2021-07-21 16:25:26.470 UTC [56] LOG: received fast shutdown request  
> 174:signal-handler (1626884726) Received SIGTERM scheduling shutdown…  
> 2021-07-21 16:25:26.473 UTC [56] LOG: aborting any active transactions  
> 174:M 21 Jul 2021 16:25:26.473 # User requested shutdown…  
> 174:M 21 Jul 2021 16:25:26.474 \* Saving the final RDB snapshot before exiting.  
> 2021-07-21 16:25:26.479 UTC [56] LOG: background worker “logical replication launcher” (PID 65) exited with exit code 1  
> 174:M 21 Jul 2021 16:25:26.480 \* DB saved on disk  
> 2021-07-21 16:25:26.480 UTC [60] LOG: shutting down  
> 174:M 21 Jul 2021 16:25:26.480 # Redis is now ready to exit, bye bye…  
> 2021-07-21 16:25:26.515 UTC [56] LOG: database system is shut down

Thanks,  
Kian

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 21, 2021, 4:27pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/2 "2021-07-21T16:27:10Z")

</div>

Can you

> [@kianwalters05](#):
>
> please scroll up and look for earlier error messages

? We really need to earlier log lines in order to provide any meaningful help.

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 4:29pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/3 "2021-07-21T16:29:07Z")

</div>

Just attached them, sorry 🙂

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 21, 2021, 4:38pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/4 "2021-07-21T16:38:16Z")

</div>

> [@kianwalters05](#):
>
> JavaScript heap out of memory

Your server doesn’t have enough RAM to install Discourse.

What is your memory and swap capacity?

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 4:58pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/5 "2021-07-21T16:58:49Z")

</div>

It has 8GB memory and 10GB swap. By the looks of it my system isnt using swap.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 21, 2021, 5:09pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/6 "2021-07-21T17:09:15Z")

</div>

Are the current application using all available memory and swappiness configured to never happen?

Since I don’t see any other reports I think it’s something on your server.

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 5:11pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/8 "2021-07-21T17:11:15Z")

</div>

Hi!  
I have 8GB memory, 10 GB swap. Im running ./launcher rebuild app and the RAM is sat at 3.4GB RAM and no swap. Im using htop and swap just says OK/10.00G. Not sure if this means swap is working or not.

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 5:12pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/9 "2021-07-21T17:12:09Z")

</div>

on HTOP swap says OK/10.00G. Not sure what this means. And the RAM is sat at 3.4G ish whilst running ./launcher rebuild app.

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 5:14pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/10 "2021-07-21T17:14:15Z")

</div>

I think it has worked. I closed Clamd with sigterm using htop. The end has a docker ID. So im guessing its worked.

Edit: Seems to be working fine. I have loaded it via IP and port and it shows up fine! Just gotta setup the reverse proxy and its all done. Thanks for the help @Falco & @pfaffman 🙂

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 6:10pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/11 "2021-07-21T18:10:14Z")

</div>

Also,  
I want to disable SSL on Discourse so it doesnt require a port. Can I disable it on Discourse and enable it on a reverse proxy, where I have the cert on my machine, etc

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 21, 2021, 6:52pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/12 "2021-07-21T18:52:12Z")

</div>

Yes, you just need to remove the first few lines on the app.yml file. The one with `ssl` on it and the one with `letsencrypt`.

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 7:04pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/13 "2021-07-21T19:04:59Z")

</div>

> [@Falco](#):
>
> Yes, you just need to remove the first few lines on the app.yml file. The one with `ssl` on it and the one with `letsencrypt` .

How would I go about doing it with an apache reverse proxy using SSL? And Can I remove the 443:443 line in app.yml also?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 21, 2021, 7:11pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/14 "2021-07-21T19:11:17Z")

</div>

Yes. Normally for doing reverse proxy you will want your service running in a unix socket. You can add the line

```plaintext
  - "templates/web.socketed.template.yml" 

```

to the templates list in the app.yml for that. Socket will be created at `/var/discourse/shared/standalone/nginx.http.sock`

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 7:15pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/15 "2021-07-21T19:15:49Z")

</div>

What would my Reverse proxy .conf look like? Or arent you too sure?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 21, 2021, 7:18pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/16 "2021-07-21T19:18:29Z")

</div>

While there are some examples by community members like [Configure Apache proxy with Let's Encrypt](https://meta.discourse.org/t/howto-setup-discourse-with-lets-encrypt-and-apache-ssl/46139) it’s outside the scope of support we provide here officially. Also keep in mind Sam warning:

> [@Configure Apache proxy with Let's Encrypt](https://meta.discourse.org/t/configure-apache-proxy-with-lets-encrypt/46139/2):
>
> Expect high levels of pain at scale if running Apache as a proxy:

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 7:20pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/17 "2021-07-21T19:20:21Z")

</div>

Ive ran apache as a proxy before so i know the stress 😃

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [July 21, 2021, 7:57pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/18 "2021-07-21T19:57:51Z")

</div>

Hi!  
Just wondering is this right for emails? As im not receiving any.

Rendered layouts/email\_template.html.erb (Duration: 0.4ms | Allocations: 30)  
Delivered mail [2d4e2472-28bc-4eba-a9d6-4ca666feb9d1@forum.domain.com](mailto:2d4e2472-28bc-4eba-a9d6-4ca666feb9d1@forum.domain.com) (6.7ms)  
Job exception: end of file reached

The email server is [mail.domain.com](http://mail.domain.com) not [forum.domain.com](http://forum.domain.com), or is that meant to be there?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 21, 2021, 8:16pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/19 "2021-07-21T20:16:41Z")

</div>

If you don’t receive the test email at `/admin/email` it’s not right 😉. You can change the SMTP setting in the app.yml and fix any mistakes.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [August 21, 2021, 4:12pm UTC](https://meta.discourse.org/t/installing-discourse-with-apache2-installed/197771/21 "2021-08-21T16:12:09Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
