Browse Source

first commit

master
junikimm717 3 years ago
commit
98538d37cf
  1. 15
      Dockerfile
  2. 9
      docker-compose.yml
  3. 19
      html/50x.html
  4. 28
      html/helloworld.cgi
  5. 23
      html/index.html
  6. 30
      vhost.conf

15
Dockerfile

@ -0,0 +1,15 @@
FROM nginx:latest
RUN apt-get clean && apt-get update
RUN apt-get install -y spawn-fcgi \
fcgiwrap \
ruby-full \
perl\
libcgi-fast-perl
RUN sed -i 's/www-data/nginx/g' /etc/init.d/fcgiwrap
RUN chown nginx:nginx /etc/init.d/fcgiwrap
ADD ./vhost.conf /etc/nginx/conf.d/default.conf
WORKDIR /var/www
CMD /etc/init.d/fcgiwrap start \
&& nginx -g 'daemon off;'

9
docker-compose.yml

@ -0,0 +1,9 @@
version: '3'
services:
web:
build:
context: .
volumes:
- ./html:/var/www/html
ports:
- "8080:80"

19
html/50x.html

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Error</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>An error occurred.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
<p>If you are the system administrator of this resource then you should check
the error log for details.</p>
<p><em>Faithfully yours, nginx.</em></p>
</body>
</html>

28
html/helloworld.cgi

@ -0,0 +1,28 @@
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
my $q = CGI->new;
print $q->header;
my $a = $q->param('a');
my $b = $q->param('b');
my $result;
$result = (scalar $a) + (scalar $b);
print <<EOF
<!DOCTYPE html>
<html>
<head><title> Hello </title></head>
<body>
<h1> Hello World </h1>
<p>
$result
</p>
</body>
</html>
EOF

23
html/index.html

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>

30
vhost.conf

@ -0,0 +1,30 @@
server {
listen 80;
listen [::]:80;
#server_name localhost;
root /var/www/html;
#access_log /var/log/nginx/host.access.log main;
location / {
index index.html index.htm;
}
#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 /var/www/html;
}
location ~ \.pl|cgi$ {
try_files $uri =404;
fastcgi_pass unix:/run/fcgiwrap.socket;
fastcgi_param SERVER_NAME \$http_host;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Loading…
Cancel
Save