diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3dbbcf3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/bin +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..893a1e9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM ubuntu:22.04 + +# Install dependencies +RUN apt update +RUN apt install nginx php-fpm php-gd -y + +# Set up nginx +COPY ./conf/nginx.conf /etc/nginx/nginx.conf +RUN mkdir -p /var/www/html +COPY ./upload.php /var/www/html/index.php + +# Start NGINX +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/LICENSE b/LICENSE index b2e7b3a..3080b92 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..8f8f857 --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,50 @@ +server { + server_name _; + listen 80; + + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 8; + gzip_buffers 16 64k; + gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + root /var/www/html; + index index.html index.htm; + + client_max_body_size 500M; + + # TCP optimizations + tcp_nopush on; + tcp_nodelay on; + + # file shit + sendfile on; + + # Keep connections alive for 15 seconds + keepalive_timeout 15; + + location ~ \.php$ { + try_files $uri =404; + + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/var/run/php/php-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param SCRIPT_NAME $fastcgi_script_name; + fastcgi_index index.php; + include fastcgi_params; + } + + location / { + expires 7d; + + open_file_cache max=1000 inactive=60s; + open_file_cache_valid 60s; + open_file_cache_min_uses 1; + open_file_cache_errors on; + + # Serve the file directly from disk + try_files $uri $uri/; + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..07befe8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.4" + +services: + sharex-php-uploader: + build: https://git.fascinated.cc/Fascinated/sharex-php-uploader.git + # Use this below if you want to build the image locally (you need to clone the repo first) + # build: . + # image: fascinated/sharex-php-uploader + restart: always + ports: + - 80:80 + volumes: + # Where to store the uploaded files + - ./uploads:/var/www/html