第一种(访问IP转发到IP+端口)
例子
server{
listen 9003;
server_name 192.168.1.114;
index index.php index.html index.htm;
location / {
proxy_pass http://127.0.0.1:9002;
}
}
当访问192.168.1.114:9003 的时候, 就会转发到192.168.1.114的9002端口, 9002端口我配置的是PHPinfo(); 所以最终会显示PHPinfo的信息.
user nginx;
worker_processes 1;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
rtmp {
access_log logs/access.rtmp.log;
server {
listen 1891;
#chunk_size 4000;
application video {
play /mnt/hgfs/paperless/PF/File/;
}
application live {
live on;
}
}
server {
listen 1935;
application live {
live on;
wait_key on;
hls_continuous on;
hls_cleanup on;
hls_nested on;
}
application hls {
live on;
hls on;
hls_path /usr/share/nginx/temp/hls;
hls_fragment 8s;
}
}
}
http {
include mime.types;
server {
listen 1892;
root /mnt/hgfs/paperless/PF/File/;
location .~ {
#on_connect http://172.16.9.225:5091/app/index/d;
mp4;
mp4_buffer_size 10m;
mp4_max_buffer_size 50m;
}
}
server {
listen 808;
server_name 192.168.3.95;
index index.php index.html index.htm;
location /{
proxy_pass http://127.0.0.1:5000;
}
}
server {
listen 8080;
location / {
root html;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root html;
}
location /hls {
#server hls fragments
types{
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
alias temp/hls;
expires -1;
}
}
}