aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile42
-rw-r--r--LICENSE22
-rw-r--r--circle.yml13
-rw-r--r--nginx.conf31
-rw-r--r--nginx.service62
5 files changed, 170 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..5f09195
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,42 @@
1FROM ubuntu:latest
2MAINTAINER clarkzjw <[email protected]>
3
4# Install Ubuntu and base software.
5RUN \
6 sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
7 apt-get update && \
8 apt-get -y -qq upgrade && \
9 apt-get install -y -qq git wget build-essential zlib1g-dev libpcre3-dev git gcc g++ make && \
10 rm -rf /var/lib/apt/lists/*
11
12# Get Source Code
13RUN \
14 wget "http://nginx.org/download/nginx-1.11.3.tar.gz" && \
15 wget "http://linux.stanford.edu/pub/exim/pcre/pcre-8.39.tar.gz" && \
16 wget "https://www.openssl.org/source/openssl-1.0.2h.tar.gz" && \
17 wget "http://zlib.net/zlib-1.2.8.tar.gz" && \
18 git clone https://github.com/cuber/ngx_http_google_filter_module && \
19 git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module && \
20 tar xzf nginx-1.11.3.tar.gz && \
21 tar xzf pcre-8.39.tar.gz && \
22 tar xzf openssl-1.0.2h.tar.gz && \
23 tar xzf zlib-1.2.8.tar.gz
24
25ADD ./nginx.service /etc/init.d/nginx
26ADD ./nginx.conf /etc/nginx/nginx.conf
27
28# Install Nginx
29RUN \
30 cd nginx-1.11.3 && \
31 ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --with-ipv6 --with-pcre=../pcre-8.39 --with-openssl=../openssl-1.0.2h --with-zlib=../zlib-1.2.8 --add-module=../ngx_http_google_filter_module --add-module=../ngx_http_substitutions_filter_module && \
32 make -j4 && \
33 make install && \
34 chmod +x /etc/init.d/nginx && \
35 /usr/sbin/update-rc.d -f nginx defaults && \
36 useradd --no-create-home nginx && \
37 mkdir -p /var/cache/nginx
38
39EXPOSE 80
40
41# Run Nginx
42CMD service nginx start && tail -F /var/log/nginx/access.log
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..9362f2a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
1The MIT License (MIT)
2
3Copyright (c) 2015 Jinwei Zhao
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all
13copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21SOFTWARE.
22
diff --git a/circle.yml b/circle.yml
new file mode 100644
index 0000000..60800d8
--- /dev/null
+++ b/circle.yml
@@ -0,0 +1,13 @@
1machine:
2 services:
3 - docker
4
5dependencies:
6 override:
7 - docker info
8 - docker build -t nginx-proxy-google .
9
10test:
11 override:
12 - docker run -d -p 8080:80 nginx-proxy-google; sleep 10
13
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..2b5da16
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,31 @@
1user nginx;
2worker_processes 1;
3
4events {
5 worker_connections 1024;
6}
7
8http {
9 include mime.types;
10 default_type application/octet-stream;
11 sendfile on;
12 keepalive_timeout 65;
13
14 server {
15 listen 80;
16 server_name localhost;
17
18 resolver 8.8.8.8;
19
20 location / {
21 google on;
22 google_scholar on;
23 google_language "en";
24 }
25
26 error_page 500 502 503 504 /50x.html;
27 location = /50x.html {
28 root html;
29 }
30 }
31} \ No newline at end of file
diff --git a/nginx.service b/nginx.service
new file mode 100644
index 0000000..7714aac
--- /dev/null
+++ b/nginx.service
@@ -0,0 +1,62 @@
1#! /bin/sh
2
3### BEGIN INIT INFO
4# Provides: nginx
5# Required-Start: $all
6# Required-Stop: $all
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9# Short-Description: starts the nginx web server
10# Description: starts nginx using start-stop-daemon
11### END INIT INFO
12
13PATH=/opt/nginx/sbin:/sbin:/bin:/usr/sbin:/usr/bin
14DAEMON=/usr/sbin/nginx
15NAME=nginx
16DESC=nginx
17
18test -x $DAEMON || exit 0
19
20# Include nginx defaults if available
21if [ -f /etc/default/nginx ] ; then
22 . /etc/default/nginx
23fi
24
25set -e
26
27case "$1" in
28 start)
29 echo -n "Starting $DESC: "
30 start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
31 --exec $DAEMON -- $DAEMON_OPTS
32 echo "$NAME."
33 ;;
34 stop)
35 echo -n "Stopping $DESC: "
36 start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
37 --exec $DAEMON
38 echo "$NAME."
39 ;;
40 restart|force-reload)
41 echo -n "Restarting $DESC: "
42 start-stop-daemon --stop --quiet --pidfile \
43 /var/run/$NAME.pid --exec $DAEMON
44 sleep 1
45 start-stop-daemon --start --quiet --pidfile \
46 /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
47 echo "$NAME."
48 ;;
49 reload)
50 echo -n "Reloading $DESC configuration: "
51 start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \
52 --exec $DAEMON
53 echo "$NAME."
54 ;;
55 *)
56 N=/etc/init.d/$NAME
57 echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
58 exit 1
59 ;;
60 esac
61
62 exit 0 \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)