AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-481583

Hauns TM's questions

Martin Hope
Hauns TM
Asked: 2022-01-12 14:09:54 +0800 CST

proxy_pass 到本地 VLC 视频流的正确 nginx 配置是什么?

  • 0

我希望能够将我的 IP 摄像机的提要转发到网站。我想通过我的 nginx 服务器(在 Ubuntu 20.04 上)公开我的网站。

首先,我使用 VLC 重新流式传输我的 IP 摄像机源:

vlc --intf dummy -vvv "rtsp://<user>:<password>@10.0.0.34:554/stream2" --sout "#transcode{vcodec=theo,vb=720,scale=Auto,acodec=none,ab=128,channels=2,samplerate=44100,scodec=none}:http{mux=ogg,dst=:8081/}" --sout-all --sout-keep --nooverlay --daemon

这意味着我在本地,在我的局域网上,可以做这样的事情

<html>
    <head>/head>
    <body>

        <video>
          <source src="http://10.0.0.63:8080" type="video/mp4">
        </video>

    </body>
</html>

好的,它可以在本地工作,但是如何配置我的 nginx 服务器以传递提要?

这就是我想要实现的:https: //my.domain.com/camera2 --nginx-server--> http://10.0.0.63:8080

<html>
    <head>/head>
    <body>

        <video>
          <source src="https://my.domain.com/camera2" type="video/mp4">
        </video>

    </body>
</html>

这是我没有成功的尝试:

http {
    proxy_cache_path  /var/www/my.domain.com/cache  levels=1:2    keys_zone=STATIC:10m  inactive=24h  max_size=1g;
    server {
            listen          80;
            server_name     my.domain.com;

            location /camera2 {
                    proxy_pass      http://10.0.0.63:8080;
                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection 'upgrade';
                    proxy_set_header Host $host;
                    proxy_cache_bypass $http_upgrade;
            }
    }
}

nginx.conf

proxy_pass 到本地 VLC 视频流的正确 nginx 配置是什么?

ubuntu nginx video-streaming
  • 1 个回答
  • 403 Views
Martin Hope
Hauns TM
Asked: 2018-10-31 10:26:17 +0800 CST

如何配置 nginx 以查找与 index.html 相关的 /js /css 的子文件夹?

  • 0

我有我的工作 Vuejs 应用程序,当我将它部署到它的生产环境时我也遇到了问题。不幸的是,我不知道应该如何设置配置?

当我从网络浏览器访问我的应用程序时(在我的例子中是http://10.0.0.4/kommandoran2.0),找到 index.html 没有问题。但是index.html找不到子文件夹中的链接文件(如 javascript 文件 [example http://10.0.0.4/kommandoran2.0/js/example.js] 或样式表 [example http://10.0.0.4/kommandoran2.0/css/example.css])。.js我对所有.css文件都有 404 错误。

生产环境: 我的操作系统是Ubuntu(在树莓派上),我的Web服务器是nginx。这是我的应用程序文件在我的生产环境中的位置:

在此处输入图像描述

编辑 1(澄清应用程序文件所在的位置):

/home/pi/kommandoran2.0/js/example.js
/home/pi/kommandoran2.0/css/example.css
/home/pi/kommandoran2.0/img/example.jpg 
/home/pi/kommandoran2.0/index.html

这是我的 nginx 配置文件中的服务器块:

server {
    listen 80 default_server;
    listen [::]:80 default_server;



    server_name mypi.example.org;
    root /var/www/html/;
    index index.php index.html index.htm;

    location /kommandoran2.0 {
        root  /home/pi;
        index index.html;

        try_files $uri $uri/ =404;


        #I believe that I need some more configuration in this block but I can't figure out what needs to be done?
    }

    location /iot {
            rewrite ^/iot(.*) $1 break;
            proxy_pass      "http://127.0.0.1:1880";
    }

    location ~ \.php$ {

        include /etc/nginx/fastcgi_params;

        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www/html/$fastcgi_script_name;
        fastcgi_param  REQUEST_URI      $request_uri;
        fastcgi_param  QUERY_STRING     $query_string;
        fastcgi_param  REQUEST_METHOD   $request_method;
        fastcgi_param  CONTENT_TYPE     $content_type;
        fastcgi_param  CONTENT_LENGTH   $content_length;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

我相信我的问题与Nginx 404 for css js files非常相似,但我不明白如何使解决方案适应我的问题。

编辑 2,浏览器中的日志和错误 这是来自 nginx 的输出/var/log/nginx/access.log(提取,我正在尝试在http://10.0.0.4/kommandoran2.0/此处浏览我的应用程序,请参阅下面的浏览器)。

10.0.0.4 - - [31/Oct/2018:12:31:37 +0100] "GET /kommandoran2.0/ HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Raspbian Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36"
10.0.0.4 - - [31/Oct/2018:12:31:37 +0100] "GET /kommmandoran2.0/css/app.cb44bddd.css HTTP/1.1" 404 200 "http://10.0.0.4/kommandoran2.0/" "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Raspbian Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36"
10.0.0.4 - - [31/Oct/2018:12:31:38 +0100] "GET /kommmandoran2.0/css/chunk-vendors.e084a3f2.css HTTP/1.1" 404 200 "http://10.0.0.4/kommandoran2.0/" "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Raspbian Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36"
10.0.0.4 - - [31/Oct/2018:12:31:38 +0100] "GET /kommmandoran2.0/js/chunk-vendors.dcf6e5da.js HTTP/1.1" 404 200 "http://10.0.0.4/kommandoran2.0/" "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Raspbian Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36"
10.0.0.4 - - [31/Oct/2018:12:31:38 +0100] "GET /kommmandoran2.0/js/app.96c7cdcf.js HTTP/1.1" 404 200 "http://10.0.0.4/kommandoran2.0/" "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Raspbian Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36"

此图像描述了对应于上述日志文件的请求: 在此处输入图像描述

问题:我应该如何让 Nginx 理解我的/js和/css文件夹的正确路径?

ubuntu
  • 3 个回答
  • 19188 Views
Martin Hope
Hauns TM
Asked: 2018-08-03 12:45:04 +0800 CST

IIS url 重写到另一个端口

  • 0

我需要有关如何思考 IIS - URL 重写 - 应用程序请求路由的策略的帮助。

例子

假设我可以通过 wifi 从外部访问我的网络服务器http://2X0.2X1.2X2.2X3(这就是今天的工作方式)。我的 IIS 网络服务器使用网页(端口 80)响应请求。好吧,我明白它是如何工作的。

在不久的将来,我还需要处理将数据发布到我的节点红色服务器实例的外部系统。节点红色服务器实例驻留在同一台 Windows 10 计算机上,但它在另一个端口 (1880) 上应答

这就是我想要实现的目标:

如果我向 发出外部请求 http://2X0.2X1.2X2.2X3/myHomePage/2/34/56,则某些内容(IIS?)应将其转换为(在我的 wifi 内)http://127.0.0.1:80/Index.aspx?value1=2&value2=34&value3=56

http://2X0.2X1.2X2.2X3/api/switch/turnOn/20, 应该翻译成http://127.0.0.1:1880/switch/turnOn/20

http://2X0.2X1.2X2.2X3/api/switch/turnOff/20, 应该翻译成http://127.0.0.1:1880/switch/turnOff/20

我的问题:我很确定 IIS URL 重写/应用程序请求路由可以在这里帮助我,但我不知道如何实现它。规则应该是怎样的?我应该使用 URL 重写吗?

编辑1:

我试图在这里描述我的情况: 在此处输入图像描述

iis
  • 1 个回答
  • 16756 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve