# Openvidu and web server

**URL:** <https://openvidu.discourse.group/t/openvidu-and-web-server/1233>\
**Category:** How to implement?\
**Tags:** v2\
**Created:** [June 19, 2020, 10:23pm UTC](https://openvidu.discourse.group/t/openvidu-and-web-server/1233 "2020-06-19T22:23:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Polygon](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@Polygon](https://openvidu.discourse.group/u/Polygon)\
**Post date:** [June 19, 2020, 10:23pm UTC](https://openvidu.discourse.group/t/openvidu-and-web-server/1233/1 "2020-06-19T22:23:56Z")

</div>

I have openvidu running on an Ubuntu 19.10 server using the Deployment \> On Premises (2.14) tutorial. I need to setup a web server, preferably Apache, so I can design a client-side UI to interact with the server. Is the deployment already using a web server that I can extend upon or do I need to install it separately?

---

<div class="post-metadata">

**Author:** ![CSantosM](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/csantosm/32/16_2.png) [@CSantosM](https://openvidu.discourse.group/u/CSantosM)\
**Post date:** [June 19, 2020, 10:48pm UTC](https://openvidu.discourse.group/t/openvidu-and-web-server/1233/2 "2020-06-19T22:48:16Z")

</div>

Hi,

I don’t understand your question pretty well

If your asking if you can extend Openvidu Server CE the answer is yes. Openvidu CE is a open source project and you can edit it by your own.

---

<div class="post-metadata">

**Author:** ![micael.gallego](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/micael.gallego/32/2_2.png) [@micael.gallego](https://openvidu.discourse.group/u/micael.gallego)\
**Post date:** [June 19, 2020, 11:01pm UTC](https://openvidu.discourse.group/t/openvidu-and-web-server/1233/3 "2020-06-19T23:01:49Z")

</div>

If you want to deploy your own app in the same server where you deployed OpenVidu, it is better if you use your own web server. In that way, you can configure it based on your needs.

To use the same certificate than OpenVidu server, take a look to this docs page: [https://docs.openvidu.io/en/2.14.0/deployment/deploying-openvidu-apps/](https://docs.openvidu.io/en/2.14.0/deployment/deploying-openvidu-apps/)

---

<div class="post-metadata">

**Author:** ![Polygon](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@Polygon](https://openvidu.discourse.group/u/Polygon)\
**Post date:** [June 22, 2020, 3:00am UTC](https://openvidu.discourse.group/t/openvidu-and-web-server/1233/4 "2020-06-22T03:00:56Z")

</div>

Ok, I got it working. To natively install apache2, all I had to do was install apache2 and configure it to use port 5442. I also removed docker-compose.override.yml (instead of changing the port to 5443).

```
$ sudo apt install apache2

```

Installation of apache2 will give a warning that the ports are already in use.

```
$ sudo systemctl stop apache2

```

The files I configured to use port 5442

```
/etc/apache2/ports.conf
/etc/apache2/sites-enabled/000-default.conf

$ sudo systemctl start apache2

$ cd /opt/openvidu
$ sudo ./openvidu restart

```

I didn’t have to do anything else to get it to use the Lets Encrypt SSL certificate. Another thing to note is that I did not need to use the port number in my domain name, which I was worried about; I’m not aware of how that is handled behind the scenes.

Now I have the issue I’m working on, which is that making requests to the API in client-side javascript results in the error: Cross-Origin Request Blocked.

---

<div class="post-metadata">

**Author:** ![micael.gallego](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/micael.gallego/32/2_2.png) [@micael.gallego](https://openvidu.discourse.group/u/micael.gallego)\
**Post date:** [June 22, 2020, 6:08am UTC](https://openvidu.discourse.group/t/openvidu-and-web-server/1233/5 "2020-06-22T06:08:28Z")

</div>

Glad to hear you are progressing.

What API is causing problems to you? OpenVidu API? Or your own app API? Remember that using OpenVidu API from frontend code is not recommended as it needs using SECRET in front end (which is unsecure as a user can stole it).

Regards

---

<div class="post-metadata">

**Author:** ![Polygon](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@Polygon](https://openvidu.discourse.group/u/Polygon)\
**Post date:** [June 22, 2020, 6:44am UTC](https://openvidu.discourse.group/t/openvidu-and-web-server/1233/6 "2020-06-22T06:44:41Z")

</div>

Right now I am using the REST API, but I was able to resolve the Cross-Origin Request Blocked message by removing “:4443” from the server URL when making a GET/POST XMLHttpRequest.

To avoid using the secret locally, it looks like I may need to transition to Node.js as the server backend because I am not aware of how to do the Node.js server side stuff with Apache unless that can be done with PHP, but I do not want to use PHP anyway.

Thanks

---

<div class="post-metadata">

**Author:** ![Polygon](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@Polygon](https://openvidu.discourse.group/u/Polygon)\
**Post date:** [June 22, 2020, 7:26am UTC](https://openvidu.discourse.group/t/openvidu-and-web-server/1233/7 "2020-06-22T07:26:55Z")

</div>

I am having trouble getting the node js tutorial to run on my deployment server.

There also seems to be a bug with something because when I execute the command to start the server, it will tell me that my usage is invalid and the output shows the secret contains stuff that I did not type

```
$ sudo node server.js https://localhost:4443 Hello_World!?!
sudo node server.js https://localhost:4443 Hello_Worldsudo node server.js https://localhost:4443/ Hello_worldsudo node server.js https://localhost:4443/ Hello_Worldsudo node server.js https://localhost:4443/ Hello_Worldsudo npm install!
Usage: node /home/username/source/openvidu-tutorials/openvidu-js-node/server.js OPENVIDU_URL OPENVIDU_SECRET

```

I have been using my domain instead of localhost and I can avoid the error above by putting the secret in quotation marks, but I have not been able to access the /api-login/login page.

```
$ sudo node server.js mydomain "mysecret"

```

but I’m not sure if it thinks the quotes are part of the secret.

---

<div class="post-metadata">

**Author:** ![micael.gallego](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/micael.gallego/32/2_2.png) [@micael.gallego](https://openvidu.discourse.group/u/micael.gallego)\
**Post date:** [June 25, 2020, 10:58am UTC](https://openvidu.discourse.group/t/openvidu-and-web-server/1233/8 "2020-06-25T10:58:42Z")

</div>

You can implement the server also in PHP if you want. Just use OpenVidu server REST API to create sessions and tokens.

Regards

---

<div class="post-metadata">

**Author:** ![rohit.roy](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@rohit.roy](https://openvidu.discourse.group/u/rohit.roy)\
**Post date:** [June 26, 2020, 5:53am UTC](https://openvidu.discourse.group/t/openvidu-and-web-server/1233/9 "2020-06-26T05:53:58Z")

</div>

No need to install Apache. I had Apache installed and some how openVidu was not working.  
Here is the steps which worked for me

1. Stop Apache
2. Installed openVidu in “/opt/” with root privileges
3. open .evn file [nano /opt/openvidu/.env] and did following changes  
DOMAIN\_OR\_PUBLIC\_IP=localhost  
OPENVIDU\_SECRET=selfsigned
4. Start openvidu if you are doing it first time otherwise only ‘ **restart** ’ will work  
./openvidu start [Only for first time later on you can just restart the server]  
./openvidu restart
5. Go to browser and type [https://localhost/](https://localhost/)  
it will ask for credentials Username and password  
Username - OPENVIDUAPP  
PASS - selfsigned [As per your config file, i have given selfsigned in .env file]  
You can also check other associated URLs  
**[https://localhost/api/sessions](https://localhost/api/sessions)**  
**[https://localhost/dashboard](https://localhost/dashboard)**  
Here your openvidu is working, Now below are the steps to start Node server
6. Checkout the sample code from [https://github.com/OpenVidu/openvidu-tutorials.git](https://github.com/OpenVidu/openvidu-tutorials.git)
7. Go to directory “/var/www/html/openvidu/ **openvidu-mvc-node** ”
8. npm install
9. node server.js [https://localhost](https://localhost): **4443** / selfsigned
  - if you get error for e.g. “URL format incorrect ReferenceError: URL is not defined”. Please check you node version it should be \>=10. If your node version is less than v10 then you will face problem.
  - Please make sure PORT 4443 given is correct and openvidu is also working on same port. If not then edit the openvidu .env file and set “HTTPS\_PORT=4443”

10. Once step 4 is done you can access your app on “[https://localhost:5000/](https://localhost:5000/)”. You can log in as per credentials shown over the form and your will be able to start and join the session.
