Add files to build a local testing nginx setup

This commit is contained in:
ICScaryThings 2022-05-29 22:26:26 -04:00
parent 0a52f62faf
commit a8a0ae5097
5 changed files with 59 additions and 0 deletions

View file

@ -12,3 +12,5 @@ docker build -t $IMAGE_NAME .
docker run --rm --name $CONTAINER_NAME -d $IMAGE_NAME
docker cp ${CONTAINER_NAME}:${RESOURCES_SRC} ${RESOURCES_DST}
docker stop $CONTAINER_NAME
cp -r ${RESOURCES_DST} nginx-test/

3
nginx-test/Dockerfile Normal file
View file

@ -0,0 +1,3 @@
FROM nginx
COPY default.conf /etc/nginx/conf.d/default.conf
COPY to-webserv/* /usr/local/share/treebird/

2
nginx-test/build_container.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
docker build -t treebird-nginx-test .

50
nginx-test/default.conf Normal file
View file

@ -0,0 +1,50 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location @treebird {
#include fastcgi_params; #Check your nginx installation for fastcgi.conf or fastcgi_param
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SCRIPT_FILENAME /usr/local/bin/treebird; # change this to the location of your treebird executable
fastcgi_param PATH_INFO $uri;
fastcgi_pass 127.0.0.1:4008;
}
location / {
root /usr/local/share/treebird; #Change this to the location of the static files
try_files $uri @treebird;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

2
nginx-test/run_container.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
docker run --rm --name nginx --network host treebird-nginx-test:latest