Я использую веб-сервер nginx в openwrt и сделал страницу с помощью сценария оболочки и HTML. Проблема в том, что команды оболочки не работают, но работают HTML-теги. Ниже мой код.
#!/bin/sh
echo "Content-type: text/html"
echo ""
echo '<html>'
echo '<head>'
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
echo '<img src="../image.png" alt="Lakshmi Tours and Travels" style="width:435px;height:312px;">'
echo '</head>'
echo '<title>Jaydeep Tours and Travels</title>'
echo '<center><h1 align='center'>Welcome To Jaydeep Tours and Travels</h1></center>'
echo '<body><center><h1 align='center'>Movies</h1></center>'
echo '
<style type="text/css">
h1 {
color: #2B2301;
margin-top: 0.9cm;
background-color: #DDD4BC;
}
#movie:before {
content: url('../bullet.png');
padding-right: 7px;
}
#movie {
font-size: 25px;
text-decoration: none;
color: #6E6E6E;
margin-left: 0.8cm;
}
p {
font-size: 20px;
color: #6E6E6E;
text-align:center;
}
</style>'
list=$(ls -l /mnt/sda2 | grep "^d" | awk -F" " '{print $9}' | sed 's/Songs//g')
list1=$(echo $list | wc -w)
if [ $list1 = 0 ]; then
files=$(ls -p /mnt/sda2 | grep -v / | sed 's/index.html//g')
files1=$(echo $files | wc -w)
j=1
while [ $j -le $files1 ]
do
videofile=$(echo $files | cut -d' ' -f$j)
video = "/$videofile"
ext=$(echo $videofile | sed 's/.*\.//')
videoname=$(echo $videofile | cut -f1 -d".")
if [ $ext = "mp4" ]; then
echo '
<div style="text-align:center">
<video width="400" height="260" controls>
<source src="'$video'" type="video/mp4">
</video></div>'
echo '<p>'$videoname'</p>'
elif [ $ext = "webm" ]; then
echo '
<div style="text-align:center">
<video width="400" height="260" controls>
<source src="'$video'" type="video/webm">
</video></div>'
echo '<p>'$videoname'</p>'
elif [ $ext = "ogv" ] || [ $ext = "ogg" ]; then
echo '
<div style="text-align:center">
<video width="400" height="260" controls>
<source src="'$video'" type="video/ogg">
</video></div>'
echo '<p>'$videoname'</p>'
fi
j=$((j+1))
done
fi
i=1
while [ $i -le $list1 ]
do
folder=$(echo $list | cut -d' ' -f$i)
echo '<a href="#" onclick="myFunction(this); return false;"
id="movie">'$folder'</a></font><br><br>'
i=$((i+1))
done
echo '
<script type="text/javascript">
function myFunction (movieElement) {
var mtype = movieElement.text
window.location.href = "luci2.sh?"+mtype;
}
</script>'
echo '<br><br><p1><center>For more movies and songs download the </p1><a
href="/TvBus.apk" style="text-decoration:none">apk</a></font>'
echo '</body></html>'
exit 0
и это мой файл nginx.conf
user nobody nogroup;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
index index.php index.html index.htm;
default_type text/html;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
server {
listen 80; # Port, make sure it is not in conflict with another http daemon.
server_name tvbus.xyz; # Change this, reference -> http://nginx.org/en/docs/http/server_names.html
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 32k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 32k;
fastcgi_temp_file_write_size 32k;
client_body_timeout 10;
client_header_timeout 10;
send_timeout 60; # 60 sec should be enough, if experiencing a lot of timeouts, increase this.
output_buffers 1 32k;
postpone_output 1460;
root /mnt/sda2; # Your document root, where all public material is.
location ~ \.php$ {
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (-f $request_filename) {
# Only throw it at PHP-FPM if the file exists (prevents some PHP exploits)
fastcgi_pass 127.0.0.1:1026; # The upstream determined above
}
}
}
}
Пожалуйста, помогите мне в этом, это будет большая благодарность.