Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to host web without nginx docker container? #40

Closed
tech-fever opened this issue May 22, 2023 · 1 comment
Closed

How to host web without nginx docker container? #40

tech-fever opened this issue May 22, 2023 · 1 comment

Comments

@tech-fever
Copy link

I already started nginx to host my other web server. Could I build server image only and reverse proxy with nginx. Thanks

@tech-fever
Copy link
Author

Problem solved.

docker-compose.yml as below (I used version 3.3 becaurse my docker-compose version 1.25.0)

version: "3.3"
services:
  server:
    build: server
    restart: unless-stopped
    ports: 
      - "127.0.0.1:4000:4000"

nginx file is mostly like nginx.ssl.conf or nginx.nossl.conf (depends on if you are using https or http)

but the root directory is youtube-dl-web/frontend/build

for example mine is /opt/youtube-dl-web/frontend/build and my nginx conf
and I am using https and certbot to issue the cert so:

server {
    listen 80;
    listen [::]:80;
    server_name your.example.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name your.example.com;
    root /opt/youtube-dl-web/frontend/build;
    ssl_certificate /etc/letsencrypt/live/your.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/your.example.com/privkey.pem;

    location / {
    }

    location /watch {
        try_files $uri $uri/ /index.html;
    }
    location /api/ {
        proxy_pass http://127.0.0.1:4000/;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant