Skip to content

Commit 9d1e7e3

Browse files
committed
add openresty
1 parent 2561740 commit 9d1e7e3

File tree

4 files changed

+109
-0
lines changed

4 files changed

+109
-0
lines changed

conf/fastcgi_params

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
3+
fastcgi_param QUERY_STRING $query_string;
4+
fastcgi_param REQUEST_METHOD $request_method;
5+
fastcgi_param CONTENT_TYPE $content_type;
6+
fastcgi_param CONTENT_LENGTH $content_length;
7+
8+
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
9+
fastcgi_param REQUEST_URI $request_uri;
10+
fastcgi_param DOCUMENT_URI $document_uri;
11+
fastcgi_param DOCUMENT_ROOT $document_root;
12+
fastcgi_param SERVER_PROTOCOL $server_protocol;
13+
fastcgi_param REQUEST_SCHEME $scheme;
14+
fastcgi_param HTTPS $https if_not_empty;
15+
16+
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
17+
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
18+
19+
fastcgi_param REMOTE_ADDR $remote_addr;
20+
fastcgi_param REMOTE_PORT $remote_port;
21+
fastcgi_param SERVER_ADDR $server_addr;
22+
fastcgi_param SERVER_PORT $server_port;
23+
fastcgi_param SERVER_NAME $server_name;
24+
25+
# PHP only, required if PHP was built with --enable-force-cgi-redirect
26+
fastcgi_param REDIRECT_STATUS 200;
27+
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";

conf/openresty.conf

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# nginx.conf -- docker-openresty
2+
#
3+
# This file is installed to:
4+
# `/usr/local/openresty/nginx/conf/nginx.conf`
5+
# and is the file loaded by nginx at startup,
6+
# unless the user specifies otherwise.
7+
#
8+
# It tracks the upstream OpenResty's `nginx.conf`, but removes the `server`
9+
# section and adds this directive:
10+
# `include /etc/nginx/conf.d/*.conf;`
11+
#
12+
# The `docker-openresty` file `nginx.vh.default.conf` is copied to
13+
# `/etc/nginx/conf.d/default.conf`. It contains the `server section
14+
# of the upstream `nginx.conf`.
15+
#
16+
# See https://github.com/openresty/docker-openresty/blob/master/README.md#nginx-config-files
17+
#
18+
19+
#user www-data;
20+
worker_processes 1;
21+
22+
error_log /var/log/nginx/openresly.error.log warn;
23+
#error_log logs/error.log notice;
24+
#error_log logs/error.log info;
25+
26+
#pid logs/nginx.pid;
27+
28+
29+
events {
30+
worker_connections 1024;
31+
}
32+
33+
34+
http {
35+
include mime.types;
36+
default_type application/octet-stream;
37+
38+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
39+
'$status $body_bytes_sent "$http_referer" '
40+
'"$http_user_agent" "$http_x_forwarded_for"'
41+
'"$request_body" $request_time $upstream_response_time';
42+
43+
access_log logs/access.log main;
44+
45+
#隐藏版本号
46+
server_tokens off;
47+
sendfile on;
48+
#tcp_nopush on;
49+
50+
#keepalive_timeout 0;
51+
keepalive_timeout 65;
52+
53+
#gzip on;
54+
55+
include /etc/nginx/conf.d/*.conf;
56+
}

docker-compose-full.yml

+18
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@ services:
1616
networks:
1717
- default
1818

19+
##Openresty与nginx只能二选一
20+
##Openresty and nginx can only choose one from the other
21+
openresty:
22+
image: openresty/openresty:${OPENRESTY_VERSION}
23+
ports:
24+
- "${OPENRESTY_HTTP_HOST_PORT}:80"
25+
- "${OPENRESTY_HTTPS_HOST_PORT}:443"
26+
volumes:
27+
- ${SOURCE_DIR}:/var/www/html/:rw
28+
- ${OPENRESTY_CONFD_DIR}:/etc/nginx/conf.d/:ro
29+
- ${OPENRESTY_CONF_FILE}:/usr/local/openresty/nginx/conf/nginx.conf:ro
30+
- ${OPENRESTY_CONF_FASTCGIPARAMS_FILE}:/usr/local/openresty/nginx/conf/fastcgi_params:ro
31+
- ${OPENRESTY_LOG_DIR}:/var/log/nginx/:rw
32+
environment:
33+
TZ: "$TZ"
34+
networks:
35+
- default
36+
1937
php72:
2038
build:
2139
context: .

env.sample

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ NGINX_CONFD_DIR=./conf/conf.d
1919
NGINX_CONF_FILE=./conf/nginx.conf
2020
NGINX_LOG_DIR=./log/nginx
2121

22+
#################### Openresty #####################
23+
OPENRESTY_VERSION=alpine
24+
OPENRESTY_HTTP_HOST_PORT=80
25+
OPENRESTY_HTTPS_HOST_PORT=443
26+
OPENRESTY_CONFD_DIR=./conf/conf.d
27+
OPENRESTY_CONF_FILE=./conf/openresty.conf
28+
OPENRESTY_CONF_FASTCGIPARAMS_FILE=./conf/fastcgi_params
29+
OPENRESTY_LOG_DIR=./log/nginx
2230

2331
############ PHP extensions #################
2432
# Available extensions:

0 commit comments

Comments
 (0)