0

OS: centos 7.6

Node version: v12.11.1

NPM version: 6.11.3

I install and config wiki.js on a virtual server, and I want to serve it, the problem is I'm not familiar with Node.js, I set up the wiki.js base on Linux install documentation: https://docs.requarks.io/en/install/linux

And now i run the node server and its served correctly :

[root@localhost html]# node server
Loading configuration from /var/www/html/config.yml... OK
2019-10-16T08:48:21.178Z [MASTER] info: =======================================
2019-10-16T08:48:21.182Z [MASTER] info: = Wiki.js 2.0.0-beta.303 ==============
2019-10-16T08:48:21.183Z [MASTER] info: =======================================
2019-10-16T08:48:21.183Z [MASTER] info: Initializing...
2019-10-16T08:48:21.808Z [MASTER] info: Connecting to database...
2019-10-16T08:48:21.936Z [MASTER] info: Database Connection Successful [ OK ]
2019-10-16T08:48:22.072Z [MASTER] warn: DB Configuration is empty or incomplete. Switching to Setup mode...
2019-10-16T08:48:22.073Z [MASTER] info: Starting setup wizard...
2019-10-16T08:48:22.420Z [MASTER] info: Starting HTTP server on port 3000...
2019-10-16T08:48:22.420Z [MASTER] info: HTTP Server on port: [ 3000 ]
2019-10-16T08:48:22.427Z [MASTER] info: HTTP Server: [ RUNNING ]
2019-10-16T08:48:22.427Z [MASTER] info: 
2019-10-16T08:48:22.427Z [MASTER] info:
2019-10-16T08:48:22.427Z [MASTER] info: Browse to http://localhost:3000/ to complete setup!
2019-10-16T08:48:22.427Z [MASTER] info:
2019-10-16T08:48:22.428Z [MASTER] info: 

but the problem is how can I run it now? My virtual machine IP is: 192.168.1.54 and I run 192.168.1.54:3000 but it says: This site can’t be reached.

What should I do?

Sebastian Kaczmarek
  • 8,120
  • 4
  • 20
  • 38
meti
  • 468
  • 1
  • 5
  • 27

1 Answers1

1

You have to open the 3000 port in the virtual machine Firewall. You can do it like this:

$ sudo firewall-cmd --zone=public --add-port=3000/tcp --permanent
$ sudo firewall-cmd --reload

And then check if it has been added successfully:

$ sudo firewall-cmd --list-ports
Sebastian Kaczmarek
  • 8,120
  • 4
  • 20
  • 38
  • i have another question , what if i want to run the script on `192.168.1.54` without 3000 port? – meti Oct 16 '19 at 13:32
  • Then you need to run it on port `80` (which is default http port) and you have to open it in the firewall – Sebastian Kaczmarek Oct 16 '19 at 13:38
  • Thank you , and how about if i want to run it on subdomain for example `wiki.voipiran.io` , what should i have to do? should i run `node server --port=80`could it interfer with loading the whole site `voipiran.io` ? – meti Oct 16 '19 at 13:46
  • If you want to have it on separate domain then you need to configure your web server (like Nginx or Apache) to redirect requests to the right application server (like wiki.js). That way, you don't really have to start the wiki.js on the port 80 because Nginx or Apache will redirect certain requests on the port of your choice – Sebastian Kaczmarek Oct 16 '19 at 13:56
  • sorry for my many questions , but how can i tell apache to redirect request right to wiki.js? for example for redirecting `192.168.1.54` to the wiki.js what should i do? i have apache on this server. – meti Oct 16 '19 at 14:18
  • I think it's a case for another question on SO – Sebastian Kaczmarek Oct 16 '19 at 14:36