Custom nginx reverse proxy to node app via custom-nginx-vhosts

Hi there.

After having successfully installed openvidu on Ubuntu 20 on an Azure VM (I can open the openvidu portal via browser), I am trying to add a vhost to a node app that is installed and running from the home folder (so outside docker).

Following the document, I added a new file to folder custom-nginx-vhosts and restart openvidu. The new custom config looks like below.

After this I cannot access the openvidu portal anymore via browser nor can i get a response from :3001/mywebsite (ERR_CONNECTION_REFUSED). Azure firewall has all required ports open.

openvideo logs -f nginx only shows good news: no errors or warnings. Full log below.

I something wrong in this vhost file ? Any help is appreciated!

– file nodeapp.conf

server {
    listen 3001 ssl;
    server_name streamer.mywebsite.io;
    # SSL config
    ssl_certificate /opt/owncert/certificate.cert;
    ssl_certificate_key /opt/owncert/certificate.key;
    location /mywebsite {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $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;
        proxy_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass_request_headers on;
    }
}

Full log

Attaching to openvidu_openvidu-server_1
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m   =======================================
e[36mopenvidu-server_1  |e[0m   =       LAUNCH OPENVIDU-SERVER        =
e[36mopenvidu-server_1  |e[0m   =======================================
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m ______________________________________________
e[36mopenvidu-server_1  |e[0m    ____               __      ___     _       
e[36mopenvidu-server_1  |e[0m   / __ \              \ \    / (_)   | |      
e[36mopenvidu-server_1  |e[0m  | |  | |_ __   ___ _ _\ \  / / _  __| |_   _
e[36mopenvidu-server_1  |e[0m  | |  | | '_ \ / _ \ '_ \ \/ / | |/ _` | | | |
e[36mopenvidu-server_1  |e[0m  | |__| | |_) |  __/ | | \  /  | | (_| | |_| |
e[36mopenvidu-server_1  |e[0m   \____/| .__/ \___|_| |_|\/   |_|\__,_|\__,_|
e[36mopenvidu-server_1  |e[0m         | |
e[36mopenvidu-server_1  |e[0m         |_|                     version 2.24.0
e[36mopenvidu-server_1  |e[0m ______________________________________________                                          
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:17,260 [main] io.openvidu.server.OpenViduServer - Starting OpenViduServer on streamer with PID 20 (/openvidu-server.jar started by root in /)
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:17,269 [main] io.openvidu.server.OpenViduServer - No active profile set, falling back to default profiles: default
e[36mopenvidu-server_1  |e[0m [ERROR] 2022-12-06 15:01:17,766 [main] io.openvidu.server.config.OpenviduConfig - .env file not found at /.env
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:17,797 [main] io.openvidu.server.config.OpenviduConfig - COTURN_SHARED_SECRET_KEY used to generate TURN users: TeHAa3bpAhmYUa6bwnKePH8ckSRSut9KLhC
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:17,975 [main] io.openvidu.server.OpenViduServer - Started OpenViduServer in 3.377 seconds (JVM running for 7.195)
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:18,027 [main] io.openvidu.server.OpenViduServer - 
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m    Configuration properties
e[36mopenvidu-server_1  |e[0m    ------------------------
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m    * CERTIFICATE_TYPE=owncert
e[36mopenvidu-server_1  |e[0m    * DOMAIN_OR_PUBLIC_IP=streamer.mydomain.io
e[36mopenvidu-server_1  |e[0m    * HTTPS_PORT=443
e[36mopenvidu-server_1  |e[0m    * KMS_URIS=["ws://localhost:8888/kurento"]
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_CDR=false
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_CDR_PATH=/opt/openvidu/cdr
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_RECORDING=false
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT=120
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_RECORDING_COMPOSED_BASICAUTH=true
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_RECORDING_COMPOSED_URL=
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/custom-layout
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_RECORDING_DEBUG=false
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_RECORDING_NOTIFICATION=publisher_moderator
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_RECORDING_PATH=/opt/openvidu/recordings
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_RECORDING_PUBLIC_ACCESS=false
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_RECORDING_VERSION=2.24.0
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_SECRET=***********************
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_SESSIONS_GARBAGE_INTERVAL=900
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_SESSIONS_GARBAGE_THRESHOLD=3600
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_STREAMS_ALLOW_TRANSCODING=false
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=MEDIA_SERVER_PREFERRED
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_STREAMS_VIDEO_MAX_RECV_BANDWIDTH=1000
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_STREAMS_VIDEO_MAX_SEND_BANDWIDTH=1000
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_STREAMS_VIDEO_MIN_RECV_BANDWIDTH=300
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_WEBHOOK=false
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_WEBHOOK_ENDPOINT=
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_WEBHOOK_EVENTS=[sessionCreated,sessionDestroyed,participantJoined,participantLeft,webrtcConnectionCreated,webrtcConnectionDestroyed,recordingStatusChanged,filterEventDispatched,mediaNodeStatusChanged,nodeCrashed,nodeRecovered]
e[36mopenvidu-server_1  |e[0m    * OPENVIDU_WEBHOOK_HEADERS=[]
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m [WARN] 2022-12-06 15:01:18,086 [main] io.openvidu.server.OpenViduServer - You have set property server.port (or SERVER_PORT). This will serve OpenVidu Server on your host at port 5443. But property HTTPS_PORT (443) still configures the port that should be used to connect to OpenVidu Server from outside. Bear this in mind when configuring a proxy in front of OpenVidu Server
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:18,086 [main] io.openvidu.server.OpenViduServer - Using /dev/urandom for secure random generation
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:18,346 [main] io.openvidu.server.OpenViduServer - Starting OpenViduServer on streamer with PID 20 (/openvidu-server.jar started by root in /)
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:18,347 [main] io.openvidu.server.OpenViduServer - No active profile set, falling back to default profiles: default
e[36mopenvidu-server_1  |e[0m [ERROR] 2022-12-06 15:01:20,605 [main] io.openvidu.server.config.OpenviduConfig - .env file not found at /.env
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:20,607 [main] io.openvidu.server.config.OpenviduConfig - COTURN_SHARED_SECRET_KEY used to generate TURN users: TeHAa3bpAhmYUa6bwnKePH8ckSRSut9KLhC
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:21,362 [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 5443 (http)
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:21,385 [main] org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-0.0.0.0-5443"]
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:21,386 [main] org.apache.catalina.core.StandardService - Starting service [Tomcat]
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:21,387 [main] org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.46]
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:21,535 [main] org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:21,536 [main] org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 3032 ms
e[36mopenvidu-server_1  |e[0m [WARN] 2022-12-06 15:01:21,955 [main] io.openvidu.server.rest.ApiRestPathRewriteFilter - Support for deprecated REST API paths enabled. Update your REST API clients to use the new paths
e[36mopenvidu-server_1  |e[0m [WARN] 2022-12-06 15:01:21,956 [main] io.openvidu.server.rest.ApiRestPathRewriteFilter - Deprecated path support will be removed in a future release. You can disable old path support to test compatibility with property SUPPORT_DEPRECATED_API=false
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:22,101 [main] io.openvidu.server.OpenViduServer - OpenVidu CDR service is disabled (may be enable with 'OPENVIDU_CDR=true')
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:22,101 [main] io.openvidu.server.OpenViduServer - OpenVidu Webhook service is disabled (may be enabled with 'OPENVIDU_WEBHOOK=true')
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:22,199 [main] io.openvidu.server.OpenViduServer - OpenVidu Server using one KMS: ws://localhost:8888/kurento
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:23,128 [main] io.openvidu.server.recording.service.RecordingManager - OpenVidu recording service is disabled
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:23,178 [main] io.openvidu.server.core.SessionManager - Garbage collector for non active sessions initialized. Running every 900 seconds and cleaning up non active Sessions more than 3600 seconds old
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:23,233 [main] org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler - Initializing ExecutorService 'jsonrpcTaskScheduler'
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:23,549 [main] org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor - Initializing ExecutorService 'applicationTaskExecutor'
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:23,787 [main] org.springframework.boot.autoconfigure.web.servlet.WelcomePageHandlerMapping - Adding welcome page: class path resource [static/index.html]
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:24,202 [main] org.springframework.security.web.DefaultSecurityFilterChain - Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@2aa27288, org.springframework.security.web.context.SecurityContextPersistenceFilter@6a078481, org.springframework.security.web.header.HeaderWriterFilter@5eefa415, org.springframework.web.filter.CorsFilter@590c73d3, org.springframework.security.web.authentication.logout.LogoutFilter@14a54ef6, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@4aa3d36, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@1929425f, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@2617f816, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@7f34a967, org.springframework.security.web.session.SessionManagementFilter@2f19f2aa, org.springframework.security.web.access.ExceptionTranslationFilter@341a8659, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@15f193b8]
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:24,265 [main] org.apache.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-0.0.0.0-5443"]
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:24,308 [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer - Tomcat started on port(s): 5443 (http) with context path ''
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:24,337 [main] io.openvidu.server.OpenViduServer - Started OpenViduServer in 6.224 seconds (JVM running for 13.557)
e[36mopenvidu-server_1  |e[0m [INFO] 2022-12-06 15:01:24,346 [main] io.openvidu.server.OpenViduServer - 
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m ----------------------------------------------------
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m    OpenVidu is ready!
e[36mopenvidu-server_1  |e[0m    ---------------------------
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m    * OpenVidu Server URL: https://streamer.mydomain.io/
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m    * OpenVidu Dashboard: https://streamer.mydomain.io/dashboard
e[36mopenvidu-server_1  |e[0m 
e[36mopenvidu-server_1  |e[0m ----------------------------------------------------
e[36mopenvidu-server_1  |e[0m