Publish nginx configuration #40

Closed
opened 2023-02-14 13:40:07 +01:00 by Benjamin_Loison · 1 comment

I added to YouTube operational API common.php:

error_reporting(E_ALL & ~E_NOTICE);

Due to the issue explained in this Git issue comment.

Nginx configuration:

server {
    server_name crawler.yt.lemnoslife.com;
    root /var/www/yt-crawler/website;

    index index.php;

    location / {
        try_files $uri $uri/ =404;
        autoindex on;
    }

    location /channels {
        rewrite ^(.*).zip/(.*)(|.json|.txt|.vtt)$ /channels.php
        autoindex on;
    }

    location /users {
        deny all;
    }

    location /websocket {
        # switch off logging
        access_log off;

        # redirect all HTTP traffic to localhost
        proxy_pass http://localhost:4430;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        # WebSocket support (nginx 1.4)
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        # timeout extension, possibly keep this short if using a ping strategy
        proxy_read_timeout 99999s;
    }

    # Below configuration isn't specific to this project.

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/crawler.yt.lemnoslife.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/crawler.yt.lemnoslife.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
I added to YouTube operational API `common.php`: ```php error_reporting(E_ALL & ~E_NOTICE); ``` Due to the issue explained in [this Git issue comment](https://github.com/Benjamin-Loison/YouTube-operational-API/issues/23#issuecomment-1423265626). Nginx configuration: ```nginx server { server_name crawler.yt.lemnoslife.com; root /var/www/yt-crawler/website; index index.php; location / { try_files $uri $uri/ =404; autoindex on; } location /channels { rewrite ^(.*).zip/(.*)(|.json|.txt|.vtt)$ /channels.php autoindex on; } location /users { deny all; } location /websocket { # switch off logging access_log off; # redirect all HTTP traffic to localhost proxy_pass http://localhost:4430; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # WebSocket support (nginx 1.4) proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # timeout extension, possibly keep this short if using a ping strategy proxy_read_timeout 99999s; } # Below configuration isn't specific to this project. location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/crawler.yt.lemnoslife.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/crawler.yt.lemnoslife.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } ```
Author
Owner

Note that as I'm hosting multiple websites, to guess which website (here the YouTube operational API one) to talk to, I'm using a private sub domain private.sub.domain. However reaching this private sub domain would require some Internet related latency while it's just a local website, so I added to /etc/hosts:

127.0.0.1   localhost private.sub.domain
Note that as I'm hosting multiple websites, to guess which website (here the YouTube operational API one) to talk to, I'm using a private sub domain `private.sub.domain`. However reaching this private sub domain would require some Internet related latency while it's just a local website, so I added to `/etc/hosts`: ``` 127.0.0.1 localhost private.sub.domain ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Benjamin_Loison/YouTube_captions_search_engine#40
No description provided.