this is my configuration and I'm getting an error:
'hls' is not allowed here
http {
access_log logs/rtmp_access.log;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location /hls {
hls;
hls_fragment 5s;
hls_buffers 10 10m;
hls_mp4_buffer_size 1m;
hls_mp4_max_buffer_size 5m;
root /run/shm;
}
#run/shm/hls/index.m3u8
# rtmp stat
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
# you can move stat.xsl to a different location
root html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
so where do I suppose to put hls? I want to use http address and m3u8 file for show some video files on jwplayer
Are you using NGINX Plus or the third party module, nginx-rtmp-module, for this functionality? Note that HLS support is not otherwise supported.
If you're using the third-party module reference the nginx.conf example in the documentation.
(Disclaimer: I am affiliated with NGINX, Inc - the company that develops NGINX and NGINX Plus).
Related
When I try www.abc.com it works but when i try www.abc.com/def or www.abc.com/ghi/ get 404 error.
Here is my nginx config
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name www.abc.com;
location / {
proxy_pass http://I/;
}
location /def{
proxy_pass http://oid-global-windows/;
}
location /ghi/ {
proxy_pass http://oid-global-windows/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
I tried to tweak the config with alias instead of proxy_pass still no luck. BTW, oid-global-windows is a docker container name and nginx is in another container hosted in same windoes server.
The setup I followed was as per this link -
https://www.mihajakovac.com/run-nginx-webserver-in-docker-on-windows/
I have a statically served React application with Nginx.
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 3000;
server_name localhost;
root /usr/share/nginx/html;
location ^~ /static/ {
root /usr/share/nginx/html/;
}
location / {
try_files $uri /index.html;
index index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
During build (with Vite) we produce source maps which are served in development.
For specific environments (stage.* and app.* but not dev.*) I would like to not serve the source maps.
I have no option to not build source maps for these environments in the first place, because we migrate entire builds between environments.
I want to use Nginx to not serve *.map files out of /static for these environments.
How would I do that?
I have a React app that runs on https://localhost:3000.
I have a domain like https://example.com/some/path.
When I enter https://example.com/some/path into my browser, I'd like it to redirect to https://localhost:3000. So the way I've seen this possible is using a reverse proxy and I'm trying to nginx setup to do so.
However I keep facing in an issue that I need include the port number when I go to the full url for example: https://example.com:3000/some/path.
How do i prevent this from happening? i.e. I'd like to just enter https://example.com/some/path.
My nginx conf file looks like this:
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 443 ssl;
server_name example.com;
ssl_certificate cert.pem;
ssl_certificate_key cert.key;
location /some/path {
return 301 $scheme://localhost:3000$request_uri;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 3000 ssl;
ssl_certificate cert.pem;
ssl_certificate_key cert.key;
server_name localhost;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
location / {
proxy_pass https://localhost:3000;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
include servers/*;
}
And in my hosts file I have the line:
127.0.0.1 example.com
Even if I keep it simple and have only one server section with location like:
location /some/path {
proxy_pass https://localhost:3000;
}
That kind of works - however looking at the console the assets themselves don't load https://example.com/static/js/bundle.js when it needs to be https://example.com:3000/static/js/bundle.js
Any help would be appreciated.
(sorry, bad english)
I have an old software, that call webpages.
But it cannot call https-pages, only http.
My nginx.conf for nginx:
worker_processes 1;
events {worker_connections 1024;}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#------------------
# from me:
server {
server_name localhost; listen 30001;
set $x https://www.example1.com/downloads;
location / { proxy_pass $x; }
}
server {
server_name localhost; listen 30002;
set $x https://www.example2.com/news;
location / { proxy_pass $x; }
}
...
#------------------
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {root html;}
}
}
Then in the software I can use:
http://localhost:30001 -> calls https://www.example1.com/downloads
http://localhost:30002 -> calls https://www.example2.com/news
Disadvantage:
I must write a server{}-Block for EVERY https-webpage into the nginx.conf.
Is ther a way to do https->http for ALL https-webpages?
Thank you very much for any help.
Hello I started using nginx, set up the nginx.conf to my project folder C: / Projects.
I used (AutoIndex: on) to have a list of directories, but does not work
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
server {
listen 80;
server_name localhost;
root C:\Project ;
index index.html index.htm index.php;
location / {
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
Move your autoindex on; outside your location block
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
server {
listen 80;
server_name localhost;
root C:\Project ;
index index.html index.htm index.php;
# moved here
autoindex on;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
If you have one of the index files present inside your root directory (or any subdirectory under C:\Project for that matter), the index page will be shown rather than the index of contents.
You may also want to check the permissions on all content under your root; they need to be readable by the user running your Nginx process.
Could be a number of different things; you'll need to clarify your questions in future with what you've tried and haven't tried.