Browse Source

update: nginx configure

master
Dnomd343 2 years ago
parent
commit
7e76708f65
  1. 16
      Dockerfile
  2. 12
      asset.sh
  3. 5
      init.sh
  4. 47
      nginx.conf
  5. 35
      nginx/alltube.conf
  6. 16
      nginx/nginx.conf

16
Dockerfile

@ -24,14 +24,10 @@ FROM ${ALPINE}
# TODO: remove php-json after php8 (>=alpine:3.16) # TODO: remove php-json after php8 (>=alpine:3.16)
# TODO: /usr/bin/python already exist after alpine:3.17 # TODO: /usr/bin/python already exist after alpine:3.17
RUN apk add --no-cache nginx python3 php-fpm php-mbstring \ RUN apk add --no-cache nginx python3 php-fpm php-mbstring \
php-dom php-gmp php-xml php-intl php-json php-gettext php-simplexml php-tokenizer php-xmlwriter php-dom php-gmp php-xml php-intl php-json php-gettext php-simplexml php-tokenizer php-xmlwriter && \
ln -s /usr/bin/python3 /usr/bin/python
COPY --from=build /alltube/ /var/www/alltube/ COPY --from=build /alltube/ /var/www/alltube/
COPY ./init.sh /usr/bin/alltube
#RUN apk add php-zip COPY ./nginx/ /etc/nginx/
#RUN EXPOSE 80
# mv -f /var/www/alltube/nginx.conf /etc/nginx/ && \ ENTRYPOINT ["alltube"]
# mv /var/www/alltube/init.sh / && \
#EXPOSE 80
#CMD ["sh","init.sh"]

12
asset.sh

@ -1,12 +0,0 @@
get_github_latest_version() {
VERSION=$(curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/');
}
apk add curl wget
mkdir -p /tmp
get_github_latest_version "Rudloff/alltube"
wget https://github.com/Rudloff/alltube/releases/download/$VERSION/alltube-$VERSION.zip -O /tmp/alltube.zip
unzip -d /tmp/ /tmp/alltube.zip
wget https://install.phpcomposer.com/installer -O /tmp/alltube/composer-setup.php
mv /nginx.conf /tmp/alltube/
mv /init.sh /tmp/alltube/

5
init.sh

@ -1,6 +1,7 @@
#!/usr/bin/env sh
if [ -n "$TITLE" ]; then if [ -n "$TITLE" ]; then
sed -i "/^appName:/cappName: $TITLE" /var/www/alltube/config/config.yml sed -i "/^appName:/cappName: $TITLE" /var/www/alltube/config/config.yml
fi fi
/usr/sbin/php-fpm7
/usr/sbin/nginx /usr/sbin/nginx
read -n 1 exec /usr/sbin/php-fpm7 -F

47
nginx.conf

@ -1,47 +0,0 @@
user nginx;
worker_processes auto;
pcre_jit on;
include /etc/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
server {
listen 80;
root /var/www/alltube;
index index.php;
types {
text/html html htm shtml;
text/css css;
text/xml xml;
application/x-web-app-manifest+json webapp;
}
location ~ /\. {
deny all;
}
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
try_files $uri /index.php?$args;
fastcgi_buffers 4 16k;
fastcgi_buffer_size 16k;
fastcgi_index index.php;
fastcgi_intercept_errors off;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param HTTPS 'ok';
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
}

35
nginx/alltube.conf

@ -0,0 +1,35 @@
server {
listen 80;
root /var/www/alltube/;
index index.php;
types {
text/html html htm shtml;
text/css css;
text/xml xml;
application/x-web-app-manifest+json webapp;
}
location ~ /\. {
deny all;
}
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
try_files $uri /index.php?$args;
fastcgi_buffers 4 16k;
fastcgi_buffer_size 16k;
fastcgi_index index.php;
fastcgi_intercept_errors off;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param HTTPS 'ok';
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

16
nginx/nginx.conf

@ -0,0 +1,16 @@
user root;
pcre_jit on;
worker_processes auto;
error_log /dev/stdout warn;
events {
worker_connections 1024;
}
http {
log_format access '[$time_iso8601] $remote_addr -> $scheme://$host - "$request"'
' -> ($status) $request_length $bytes_sent {$http_user_agent}';
access_log /dev/stdout access;
include /etc/nginx/mime.types;
include /etc/nginx/alltube.conf;
}
Loading…
Cancel
Save