File tree 5 files changed +73
-1
lines changed
5 files changed +73
-1
lines changed Original file line number Diff line number Diff line change
1
+ # XXX(minho): Inherited from https://medium.com/@lojorider/docker-with-cgi-perl-a4558ab6a329
2
+
3
+ FROM nginx:1.10
4
+ RUN apt-get update
5
+ RUN apt-get install -y spawn-fcgi fcgiwrap
6
+ RUN apt-get install -y gcc
7
+ RUN sed -i 's/www-data/nginx/g' /etc/init.d/fcgiwrap
8
+ RUN chown nginx:nginx /etc/init.d/fcgiwrap
9
+ RUN mkdir -p /var/log/nginx/web
10
+ ADD ./vhost.conf /etc/nginx/conf.d/default.conf
11
+
12
+ WORKDIR /var/www
13
+ COPY ./www/*.c ./
14
+ RUN gcc -o index.out ./index.c
15
+ RUN gcc -o about.out ./about.c
16
+
17
+ EXPOSE 80
18
+
19
+ CMD /etc/init.d/fcgiwrap start \
20
+ && nginx -g 'daemon off;'
Original file line number Diff line number Diff line change 1
- # docker-c-cgi-x-nginx-helloworld
1
+ # docker-c-cgi-x-nginx-helloworld
2
+
3
+ [ ![ Run on Ainize] ( https://ainize.ai/static/images/run_on_ainize_button.svg )] ( https://ainize.web.app/redirect?git_repo=github.com/minho-comcom-ai/docker-c-cgi-x-nginx-helloworld )
4
+ - Docker Hub: [ minhocomcomai/helloworld-c] ( https://hub.docker.com/r/minhocomcomai/helloworld-c )
5
+
6
+ ## Build
7
+
8
+ ``` bash
9
+ docker build -t helloworld-c
10
+ ```
11
+
12
+ ## Run
13
+
14
+ ``` bash
15
+ docker run -it -p 80:80 helloworld-c
16
+ ```
17
+
18
+ ## Upload to Docker Hub
19
+
20
+ ``` bash
21
+ docker tag helloworld-c $YOURID /helloworld-c
22
+ docker push $YOURID /helloworld-c
23
+ ```
Original file line number Diff line number Diff line change
1
+ error_log stderr;
2
+ access_log stdout;
3
+
4
+ server {
5
+ listen 80;
6
+ index index.out index.html;
7
+ root /var/www;
8
+ location ~ \.out$ {
9
+ gzip off;
10
+ fastcgi_param SERVER_NAME \$http_host;
11
+ include /etc/nginx/fastcgi_params;
12
+ fastcgi_pass unix:/var/run/fcgiwrap.socket;
13
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+
3
+ int main (){
4
+ printf ("Content-type: text/html\n\n" );
5
+ printf ("About World!" );
6
+ return 0 ;
7
+ }
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+
3
+ int main (){
4
+ printf ("Content-type: text/html\n\n" );
5
+ printf ("Hello World!\n" );
6
+ printf ("<a href='/about.out'>About</a>!\n" );
7
+ return 0 ;
8
+ }
You can’t perform that action at this time.
0 commit comments