uaktags / explorer

An open source block explorer
BSD 3-Clause "New" or "Revised" License
6 stars 8 forks source link

Multicoin #30

Closed spy0012 closed 5 years ago

spy0012 commented 5 years ago

This is not an issue but more of a question, i am using your explorer as you know, before all the cluster work. My question is i know you are looking at multicoin support but i am trying to run 2 explorers on one semi decent server and i am using ssl on both however

One explorer is using port 443 for the ssl, i am trying to launch a second explorer but cannot because 443 is being used even though i have use --port 445 when sending npm start, gives me the in use error.

Just wondering if you knew of a way to launch two on the same server two different url folders with all packages in each including force ssl and forever.

Any help you can provide will be much appreciated, i have also changed the default port for both 8082 and 8083 but still try's to access 443.

I think the problem i have could be force ssl trying to open the default port even though it's used. I could be totally wrong and i can't run two with ssl.

Update:

Got it working on two different ports, but i have to use the port number at the end url:441 as the other explorer has port 80 redirected to 443 and i can't redirect the same port to two different ports as far as i am aware.

Do you know of a better way to get them to work without appending the port to the url

uaktags commented 5 years ago

Use nginx in front of it instead as a reverse proxy. I never setup an explorer to use nginx ports (or anything outside of the typical 80/443). Then point your A record to the nginx webserver. Let that proxy_pass from 443 to whatever port the explorer is running on. Add the SSL to the nginx config.

So, you have a semi-decent server. Have it run 2 explorers with ports 3001 (coin1.com) and 3002 (coin2.com). On this server install nginx. Add a virtual host (server) config for each website. It'll look something like this:

server {
  listen 443;
  server_name coin1.com;
  location / {
        proxy_pass https://127.0.0.1:3001;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
  }
  ssl on;
  ssl_certificate /path/to/coin1.com.pem;
  ssl_certificate_key /path/to/coin1.com.key;
}
server {
  listen 80;
  server_name coin1.com;
  location / {
        proxy_pass http://127.0.0.1:3001;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
  }
}

Now going to http or https coin1.com should point you to one of the explorers. Create the site configs for the other coin and you should be in business with a nginx restart.

Note I'm kinda winging that above with the configs, just pulled the proxy stuff out of my snippets I have, but looking at it it should be good. The logic looks workable. Just test in a vm and then check error log for any issue.

spy0012 commented 5 years ago

thanks, will check it out, might just separate them a lot easier and probably long term more stable