console-remote-server icon indicating copy to clipboard operation
console-remote-server copied to clipboard

Deploy on production using Apache

Open Juzepe opened this issue 4 years ago • 22 comments

I tried launch on production, but I got error:

http://www.my-domain/www/css/www-bundle-bf7fd723c9.css net::ERR_ABORTED 404 (Not Found)

Maybe, it is due to relative paths?

Juzepe avatar Mar 26 '21 13:03 Juzepe

@Juzepe, no path is absolute, it should work, if you look at build/www/index.htmlfile you should see link to /www/css/www-bundle-bf7fd723c9.css there is something in your webserver config. Can you load js files with direct link like http://www.my-domain/www/js/index-bundle-16773faef7.js ?

kurdin avatar Mar 26 '21 13:03 kurdin

No, same error.

Juzepe avatar Mar 26 '21 13:03 Juzepe

but you can load and see www/index.html when you hit your http://www.my-domain/ right ?

kurdin avatar Mar 26 '21 13:03 kurdin

Yes.

Juzepe avatar Mar 26 '21 13:03 Juzepe

As I see www is unnecessary?

<link rel="stylesheet" href="/www/css/www-bundle.css" />

Juzepe avatar Mar 26 '21 13:03 Juzepe

Yes, I need that for localhost. Do you use nginx ?

kurdin avatar Mar 26 '21 13:03 kurdin

I use Apache.

Juzepe avatar Mar 26 '21 13:03 Juzepe

oh, ok. I did not use Apache for a long time. Try this

copy your console server build folder to your /home/www/console/build Root of webserver should be in DocumentRoot /home/www/console/build but index.html should have path DirectoryIndex /www/index.html that should be inside DocumentRoot

kurdin avatar Mar 26 '21 13:03 kurdin

with Nginx, this is a pretty easy to do

root /home/www/console/build;
location / {
          index /www/index.html;
          try_files $uri $uri/ /app/consoleapp.html;
    }

kurdin avatar Mar 26 '21 13:03 kurdin

I moved index.html file from build/www folder to build folder and it works now. :)

But when I go to http://www.my-domain/my-project it goes to error: 404 (Not Found). As I guess because of Apache.

Juzepe avatar Mar 26 '21 14:03 Juzepe

But when I go to http://www.my-domain/my-project it goes to error: 404 (Not Found)

This is because in Apache you need to have rewrite rule for any /url-path (but static files) to load a html file from /app/consoleapp.html

This is how it works on Nginx try_files $uri $uri/ /app/consoleapp.html;

kurdin avatar Mar 26 '21 15:03 kurdin

@Juzepe do you have any progress with setting up Apache and console remote server on production ?

kurdin avatar Mar 30 '21 13:03 kurdin

I'm out of town and I will find out soon. Thanks.

On Tue, Mar 30, 2021 at 5:40 PM Sergey @.***> wrote:

@Juzepe https://github.com/Juzepe do you have any progress with setting up Apache and console remote server on production ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kurdin/console-remote-server/issues/2#issuecomment-810255679, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKSBSOKT3UWDEYGLIE3TSLTGHIEPANCNFSM4Z3LT6MA .

Juzepe avatar Mar 30 '21 13:03 Juzepe

I tried many things without success. Can you give us rights on https://console.re/ to connect from servers also?

As I remember, we had such right.

Juzepe avatar Apr 02 '21 13:04 Juzepe

I tried rewrite rules, but http://www.my-domain/my-project looks like exactly http://www.my-domain.

Juzepe avatar Apr 02 '21 13:04 Juzepe

I tried many things without success.

can you install a docker on your server ? I can create a console remote server docker with nginx.

Can you give us rights on https://console.re/ to connect from servers also?

Unfortunately I can't, because it quickly gets abused by many many request from different production servers and clients and my server could not keep up with that load.

I tried rewrite rules, but http://www.my-domain/my-project looks like exactly http://www.my-domain.

that means rewrite rule does not work correctly, it should take any uri like /my-project and load static file from /app/consoleapp.html and not index.html

kurdin avatar Apr 02 '21 13:04 kurdin

@Juzepe btw, try to rename consoleapp.html to index.html and replace your current index with new file. This should work as quick fix.

kurdin avatar Apr 02 '21 13:04 kurdin

I found solution. Inside Directory must be:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . app/consoleapp.html [L]```

But I have another problem: `consoleRe [warning] seems like you trying to use console remote on public, production server. Console.Re is for light, local development only, for production you can install and use self hosted solution`. Same as on https://console.re/

Juzepe avatar Apr 02 '21 14:04 Juzepe

But I have another problem: consoleRe [warning] seems like you trying to use console remote on public, production server. Console.Re is for light, local development only, for production you can install and use self hosted solution. Same as on https://console.re/

let me check that

kurdin avatar Apr 02 '21 15:04 kurdin

@Juzepe did you change connection option server: 'https://your-remote-console-server-name.com' ? did you try connect to your console server from localhost ?

kurdin avatar Apr 02 '21 15:04 kurdin

Now I'm struggling to CORS policy :)

Juzepe avatar Apr 02 '21 17:04 Juzepe

@Juzepe you need to look for Apache CORS solution. Sorry can't help with this.

kurdin avatar Apr 03 '21 00:04 kurdin