Install Discourse, change docker port 80

Hi, i want install Discourse, i have docker but i need change the port server from 80:80 for 10080:80 because my por 80 is not free.

1 Like

In you app.yml edit :

expose:

  • “10080:80”
  • “2222:22”

And

./launcher rebuild app

6 Likes

Thank’s for the answer @Vernam

Is there a way to so this in the ./discourse-setup step?
I’d like to have the alternate port set right from the start rather than having to rebuild.

2 Likes

Don’t run discourse-setup, edit app.yml directly, run launcher bootstrap app.

4 Likes

thanks, that’s easier than mucking about with templates!

Copy the sample file

sudo cp samples/standalone.yml containers/app.yml

open it

sudo nano containers/app.yml

and change the port on line 23

- "8080:80"   # http

rebuild it

./launcher bootstrap app
8 Likes

You sir a white knight! Ty a million!

1 Like

Unfortunately this changed port is not considered, and it navigates me to http://mercury/finish-installation/confirm-email instead of http://mercury:3333/finish-installation/confirm-email.

Also the http://mercury:3333/u/activate-account/ page is broken, nothing happens if I click the “Click here to activate your account” button.

Console log for the confirmation page:

Loading failed for the <script> with source “http://mercury:3333/assets/ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js”. confirm-email:5:1
Loading failed for the <script> with source “http://mercury:3333/assets/wizard-vendor-478203d0e6de278e15e12305ec1c7cc58c60f41a3ceb4c32683113e199fe575c.js”. confirm-email:7:1
Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). Source: ;!function(){var t,e,n,o=0,u=function(t,e){return"function"!=typeof t||t.replaced?t:(e.replaced=!0,e)};if("undefined"!=typeof CustomEvent&&"function"==typeof window.dispatchEvent){var r=function(t){try{if("object"==typeof t&&(t=JSON.stringify(t)),"string"==typeof t)return window.dispatchEvent(new CustomEvent("lprequeststart",{detail:{data:t,requestID:++o}})),o}catch(t){}},s=function(t){try{window.dispatchEvent(new CustomEvent("lprequestend",{detail:t}))}catch(t){}};"undefined"!=typeof XMLHttpRequest&&XMLHttpRequest.prototype&&XMLHttpRequest.prototype.send&&(XMLHttpRequest.prototype.send=u(XMLHttpRequest.prototype.send,(n=XMLHttpRequest.prototype.send,function(t){var e=this,o=r(t);return o&&e.addEventListener("loadend",function(){s({requestID:o,statusCode:e.status})}),n.apply(e,arguments)}))),"function"==typeof fetch&&(fetch=u(fetch,(e=fetch,function(t,n){var o=r(n),u=e.apply(this,arguments);if(o){var c=function(t){s({requestID:o,statusCode:t&&t.status})};u.then(c).catch(c)}return u})));var c=function(t){return u(t,function(){try{this.dispatchEvent(new CustomEvent("lpsubmit"))}catch(t){}return t.apply(this,arguments)})},i=function(){if(document&&document.forms&&document.forms.length>0)for(var t=0;t<document.forms.length;++t)document.forms[t].submit=c(document.forms[t].submit)};document&&"interactive"===document.readyState||"complete"===document.readyState?i():window.addEventListener("DOMContentLoaded",i,!0),Document.prototype.createElement=u(Document.prototype.createElement,(t=Document.prototype.createElement,function(){var e=t.apply(this,arguments);return e&&"FORM"===e.nodeName&&e.submit&&(e.submit=c(e.submit)),e}))}}();. confirm-email:1:1
Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). Source: ;(function(e){if(!e.__REACT_DEVTOOLS_GLOBAL_HOOK__){var n=!1,t={_renderers:{},helpers:{},checkDCE:function(e){try{Function.prototype.toString.call(e).indexOf("^_^")>-1&&(n=!0,setTimeout(function(){throw new Error("React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://fb.me/react-perf-use-the-production-build")}))}catch(e){}},inject:function(e){var r=Math.random().toString(16).slice(2);t._renderers[r]=e;var o=n?"deadcode":function(e){try{if("string"==typeof e.version)return e.bundleType>0?"development":"production";var n=Function.prototype.toString;if(e.Mount&&e.Mount._renderNewRootComponent){var t=n.call(e.Mount._renderNewRootComponent);return 0!==t.indexOf("function")?"production":-1!==t.indexOf("storedMeasure")?"development":-1!==t.indexOf("should be a pure function")?-1!==t.indexOf("NODE_ENV")?"development":-1!==t.indexOf("development")?"development":-1!==t.indexOf("true")?"development":-1!==t.indexOf("nextElement")||-1!==t.indexOf("nextComponent")?"unminified":"development":-1!==t.indexOf("nextElement")||-1!==t.indexOf("nextComponent")?"unminified":"outdated"}}catch(e){}return"production"}(e);return t.emit("renderer",{id:r,renderer:e,reactBuildType:o}),r},_listeners:{},sub:function(e,n){return t.on(e,n),function(){return t.off(e,n)}},on:function(e,n){t._listeners[e]||(t._listeners[e]=[]),t._listeners[e].push(n)},off:function(e,n){if(t._listeners[e]){var r=t._listeners[e].indexOf(n);-1!==r&&t._listeners[e].splice(r,1),t._listeners[e].length||(t._listeners[e]=null)}},emit:function(e,n){t._listeners[e]&&t._listeners[e].map(function(e){return e(n)})},supportsFiber:!0,_fiberRoots:{},getFiberRoots:function(e){var n=t._fiberRoots;return n[e]||(n[e]=new Set),n[e]},onCommitFiberUnmount:function(e,n){t.helpers[e]&&t.helpers[e].handleCommitFiberUnmount(n)},onCommitFiberRoot:function(e,n){var r=t.getFiberRoots(e),o=n.current,i=r.has(n),u=null==o.memoizedState||null==o.memoizedState.element;i||u?i&&u&&r.delete(n):r.add(n),t.helpers[e]&&t.helpers[e].handleCommitFiberRoot(n)}};Object.defineProperty(e,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{value:t})}}(window))
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeObjectCreate = Object.create;
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeMap = Map;
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeWeakMap = WeakMap;
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.nativeSet = Set;

window.__REACT_DEVTOOLS_GLOBAL_HOOK__.on('renderer', function(evt) {
  window.postMessage({
    source: 'react-devtools-detector',
    reactBuildType: evt.reactBuildType,
  }, '*');
});
. confirm-email:1:1
Content Security Policy: The page’s settings blocked the loading of a resource at http://mercury:3333/assets/ember_jquery-716f4989c2eb49ad65163ffb56185407340c2b195b81b9392b62cde3e992cade.js (“script-src”).
Content Security Policy: The page’s settings blocked the loading of a resource at http://mercury:3333/assets/wizard-vendor-478203d0e6de278e15e12305ec1c7cc58c60f41a3ceb4c32683113e199fe575c.js (“script-src”). 

We don’t support running Discourse in a non-standard (80/443) port.

Changing the port in the app.yml file is there to allow you to use a reverse proxy that will listen in a standard port and forward traffic internally to the higher port.

That is an advanced setup and we recommend just using the official guide for people who aren’t familiar with server administration.

5 Likes

Running Discourse front end on a custom port is not something we support, you can export it out of docker under a different port and then have the load balancer fix it. BUT having the final place users in production visit be http://magic.com:8922 is not something we support.

5 Likes

someone can show how to do this…please

Hello, I have a site on port 80. I moved the discourse site to port 8080, but it redirects to the main site.

It’s 2024, any luck on this?

What’s this? Running Discourse with an external reverse proxy that controls the web ports is supported, and we even ship with a template that runs Discourse while listening on a unix socket to make this integration seamless.

1 Like

This topic was automatically closed after 3249 days. New replies are no longer allowed.