我在ubuntu 16.04服务器上运行nginx 1.4.6。我的内容包含文件夹ffmpeg \
-f x11grab -video_size 3840x2160 -framerate 30 -i :1.0 \
-f v4l2 -video_size 320x240 -framerate 30 -i /dev/video1 \
-f alsa -ac 2 -i pulse -i logo.png -filter_complex \
"[0:v]scale=1920:-1,setpts=PTS-STARTPTS[bg]; \
[1:v]scale=160:-1,setpts=PTS-STARTPTS[fg]; \
[bg][fg]overlay=W-w-10:10[bg2]; \
[bg2][3:v]overlay=W-w-10:H-h-10,format=yuv420p[out]" \
-map "[out]" -map 2:a -c:v libx264 -preset veryfast \
-maxrate 9000k -bufsize 12000k -c:a aac -b:a 160k -ar 44100 -b:a 128k \
-force_key_frames "expr:gte(t,n_forced*2)" \
-c copy -f flv rtmp://a.rtmp.youtube.com/live2/TOKEN
-c copy -f mp4 out.mp4
,ffmpeg version 3.1.7 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.1 (GCC) 20161221 (Red Hat 6.3.1-1)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --extra-cflags=-I/usr/include/nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
[x11grab @ 0x562f6e929c20] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':1.0':
Duration: N/A, start: 1496800335.695598, bitrate: N/A
Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 3840x2160, 30 fps, 1000k tbr, 1000k tbn, 1000k tbc
Input #1, video4linux2,v4l2, from '/dev/video1':
Duration: N/A, start: 17665.258327, bitrate: 36864 kb/s
Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 36864 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #2.0 : stereo
Input #2, alsa, from 'pulse':
Duration: N/A, start: 1496800336.972575, bitrate: 1536 kb/s
Stream #2:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Input #3, png_pipe, from 'logo.png':
Duration: N/A, bitrate: N/A
Stream #3:0: Video: png, rgba(pc), 190x105 [SAR 2835:2835 DAR 38:21], 25 tbr, 25 tbn, 25 tbc
Streamcopy requested for output stream 0:0, which is fed from a complex filtergraph. Filtering and streamcopy cannot be used together.
➜ tmp
和/var/www/html/
中的两个文件。所有文件都被chmod到755并且属于用户index.html
。我的nginx.conf:
test.html
我在/ etc / nginx / sites-enabled /中的配置文件:
www-data
当我浏览http://example.com/(不是真正的主机名)时,我看到了user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
(yay)的内容。当我浏览http://example.com/test.html时,我得到了HTTP 404.当我尝试使用curl和任何浏览器时,我得到了这个。
此网站(以及服务器故障)上的许多其他问题似乎表明使用重写规则提供静态内容或与反向代理其他服务相结合的问题。我只是希望能够提供可以想象的最简单的静态网站。
access.log和error.log都不显示任何请求都会通过。日志文件由用户www-data拥有并允许写访问。
答案 0 :(得分:1)
在访问example.com
的当前配置中,控件将为
转到location /
阻止那里你没有提到的入口点,因此
将配置更改为
server {
listen 80;
root /var/www/html/;
index index.html index.htm;
server_name example.com;
}
或
server {
listen 80;
index index.html index.htm;
server_name example.com;
location /{
# you can use alias instead
root /var/www/html/;
}
}