Running other websites on the same machine as Discourse


(Jay Pfaffman) #139

The difference between “not recommended” and “not supported” significant, but subtle. :smile:


(Prakarsh Upmanyu) #140

I was able to do that but I am not sure whether it was the right and secure way or not. Here is what I did:

In discourse.conf, I replaced

proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;

with

proxy_pass http://www.example.com:2560/forum;

and in app.yml expose section, I replaced:

- 80:80

with

- 2560:80

I have my apache (now listening to port 8080) serve the rest of www.example.com. To do that, I created another location block within the same server block as my forum location block which looks something like:

location / {
    ..... <some other proxy params>......
    proxy_pass http://www.example.com:8080;
}

I don’t know if this is the correct way (more importantly the secure way), but things are working for now.
If someone has any suggestion to improve this, please reply.


(Pad Pors) #141

in our case, we had to change these two lines as ssl.crt and ssl.key didn’t exist and instead two other files named oursite.com.cer and oursite.com.key were there in the /var/discourse/shared/standalone/ssl/ folder.

things are alright though.


(SMHassanAlavi) #142

I have a problem with nginx config file.
I added this to my discourse.conf:

location /google/ {

        proxy_pass http://www.google.com;
}

and when I open mysite.com/google I will reverse to http://www.google.com/google.
But I want to reverse to http://www.google.com.
Can anyone help me?


(Kai Liu) #143

There proxy_pass directive should be proxy_pass http://www.google.com/;. Mind the last /.


(SMHassanAlavi) #144

I have another problem with this method.
we have installed THIS plugin on my site and I had this before doing these steps. But after this my widget disappeared.and I don’t khow why nginx made my widget disappearing.
NOTE:We have config nginx as HTTPS.Can the problem be from the link I have used in my widget?


(SMHassanAlavi) #145

We make changes as the topic said but I have a problem Now after doing this:
our site is padpors.com
when we enter these following url, the site loaded well:
http://padpors.com https://padpors.comhttps://www.padpors.com
but by opening this url we see nginx welcome page:
http://www.padpors.com
What should we do?
we use cloudflare but we can’t fix this problem with cloudflare


(Joshua Rosenfeld) #146

You’re going to need to edit your nging conf file. Sounds like you want a permanent redirect (301) from http://www.padpors.com to https://padpors.com.


(SMHassanAlavi) #147

So how should I do that?
I have done the HTTPS part of tutorial but now I have problem with HTTP


(Joshua Rosenfeld) #148

I’m not sure. The above tutorial assumes your forum is in a subdomain, but it would appear that your site is at the root domain. Can you share your nginx conf file?


(Christoph) #149

Be careful though with permanent redirects like this. They are very permanent. For redirecting the www subdomain to the main domain, I believe it’s better (and much easier) to either create a CNAME or A record in your DNS, i.e. either a CNAME for www pointing to the main domain or an A record for WWW pointing to the same IP as the main domain.


(SMHassanAlavi) #150

This is my discourse.conf

server {
    listen 80; listen [::]:80;
    server_name padpors.com; 

    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;  listen [::]:443 ssl http2;
    server_name padpors.com;  

    ssl on;
    ssl_certificate      /var/discourse/shared/standalone/ssl/***.cer;
    ssl_certificate_key  /var/discourse/shared/standalone/ssl/***.key;
    ssl_dhparam          /var/discourse/shared/standalone/ssl/***.pem;
    ssl_session_tickets off;
    ssl_ciphers *********;

    http2_idle_timeout 5m; # up from 3m default

    location / {
        proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }
    location /******r/ {
	
	proxy_pass http://145.30.4.93:6532/;
	
    }
}

we have done this before. but dns redirect to our VPS IP,(the page showong nginX welcome).
I think we should redirect it with nginx reverse proxy


(Joshua Rosenfeld) #151

First, I think you forgot the conf file.

Second, I am by no means an expert on HTTPS, DNS, and Nginx. I’d trust some of the other users (like @tophee or @mpalmer) far more than I’d trust myself on topics like this.


(chamunks) #152

Okay well, I’m going to try here, I’m probably going to get nowhere with this like I did last year. But since I still think that this is probably the best forum software you can find. I’m trying to get this to run on a machine where I cannot take down the main website that on both port 80 and port 443. I can’t seem to find any documentation on how to install Discourse without the ./discourse-setup script that will not work in this case.


(Matt Palmer) #153

Since discourse-setup is a shell script, you could, if you were feeling masochistic, get the instructions out of there and modify to suit. A simpler method would be to comment out the call to check_ports on or about line 591 and run the script.

Alternately, all discourse-setup really does is provide a user-friendly wrapper around copying samples/standalone.yml to containers/app.yml and editing it as required based on your answers to questions.


(Sam Saffron) #154

I am so so confused here. Like 100% :confounded: and :confused:

This times 100, times another 100.

There is this file

It has a tremendous amount of comments and is not so dissimilar to what docker compose has. Our install involves, copying this file and editing this file… that is about all there is to it.

Don’t want to expose port 80?

No problems:

Edit

expose:
  - "80:80"   # http
  - "443:443" # https

To

# Nothing

(Ian Lawrence) #155

Hi
Followed the instructions at the top and everything works well apart from email registration links. These are like

http://some-server/invites/0c0079e784a8e75b80db04a3c62520e5

where can i set that? Total Discourse newbie sorry


(Kane York) #156

You don’t have the hostname set correctly in containers/app.yml, I think.


(Ian Lawrence) #157

Hi

Sorry if i was not clear. Its the http and not https in the link…not the actual hostname (that is correct)

Thx!


(Jay Pfaffman) #158

I think that what you need to do is either configure your reverse proxy server to redirect http to https (which you should probably do anyway) or set the force https system setting (which won’t hurt if https is working).