Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Roman Litvinenko
jameditor-api
Commits
bc8f97b2
Commit
bc8f97b2
authored
Sep 18, 2018
by
thiaramus
Browse files
Added docker nginx environment
parent
4d1217e4
Changes
5
Hide whitespace changes
Inline
Side-by-side
api/include/auth.inc.php
View file @
bc8f97b2
...
...
@@ -24,8 +24,13 @@
$user
=
false
;
$apiKey
=
filter_input
(
INPUT_SERVER
,
'HTTP_X_API_TOKEN'
,
FILTER_SANITIZE_STRING
);
$apiUsername
=
filter_input
(
INPUT_SERVER
,
'HTTP_X_API_USERNAME'
,
FILTER_SANITIZE_STRING
);
// Apache
//$apiKey = filter_input(INPUT_SERVER, 'HTTP_X_API_TOKEN', FILTER_SANITIZE_STRING);
//$apiUsername = filter_input(INPUT_SERVER, 'HTTP_X_API_USERNAME', FILTER_SANITIZE_STRING);
// NGINX
$apiKey
=
array_key_exists
(
'HTTP_X_API_TOKEN'
,
$_SERVER
)
?
$_SERVER
[
'HTTP_X_API_TOKEN'
]
:
NULL
;
$apiUsername
=
array_key_exists
(
'HTTP_X_API_USERNAME'
,
$_SERVER
)
?
$_SERVER
[
'HTTP_X_API_USERNAME'
]
:
NULL
;
if
(
$apiKey
!=
NULL
)
{
if
(
hash_equals
(
hash
(
'sha256'
,
$apiKey
),
$cfg
[
'users'
][
$apiUsername
][
'password'
]))
{
...
...
api/index.php
View file @
bc8f97b2
...
...
@@ -37,7 +37,11 @@
require_once
'include/init.inc.php'
;
// Grab request URI and parse it into the array
$uri
=
filter_input
(
INPUT_SERVER
,
'REQUEST_URI'
,
FILTER_SANITIZE_STRING
);
// Apache
//$uri = filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING);
// NGINX
$uri
=
array_key_exists
(
'REQUEST_URI'
,
$_SERVER
)
?
$_SERVER
[
'REQUEST_URI'
]
:
NULL
;
$parsedUri
=
parse_url
(
$uri
);
// Generate apiClass name from the first URI keyword.
...
...
docker-nginx/docker-compose.yml
0 → 100644
View file @
bc8f97b2
version
:
'
2'
services
:
jameditor-api
:
build
:
./images/lnp
ports
:
-
"
80:80"
volumes
:
-
../:/var/www/jameditor-api
-
../fidosample/fidoconf:/usr/local/etc/fidoconf
-
../fidosample/messagebase:/var/fido/messagebase
-
../fidosample/nodelist:/var/fido/nodelist
environment
:
# Windows Docker
ENABLE_XDEBUG
:
1
XDEBUG_CONFIG
:
remote_host=10.0.75.1
# Linux Docker
# XDEBUG_CONFIG: remote_host=172.18.0.1
\ No newline at end of file
docker-nginx/images/lnp/Dockerfile
0 → 100644
View file @
bc8f97b2
FROM
richarvey/nginx-php-fpm
COPY
config/jameditor-api.local.conf /etc/nginx/sites-available/default.conf
docker-nginx/images/lnp/config/jameditor-api.local.conf
0 → 100644
View file @
bc8f97b2
server
{
listen
80
;
## listen for ipv4; this line is default and implied
listen
[::]:
80
default
ipv6only
=
on
;
## listen for ipv6
root
/
var
/
www
/
jameditor
-
api
/
api
;
index
index
.
php
index
.
html
index
.
htm
;
# Make site accessible from http://localhost/
server_name
jameditor
-
api
.
local
;
# Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
sendfile
off
;
# Add stdout logging
error_log
/
dev
/
stdout
info
;
access_log
/
dev
/
stdout
;
# Add option for x-forward-for (real ip when behind elb)
#real_ip_header X-Forwarded-For;
#set_real_ip_from 172.16.0.0/12;
location
/ {
try_files
$
uri
/
index
.
php
=
404
;
fastcgi_split_path_info
^(.+\.
php
)(/.+)$;
fastcgi_pass
unix
:/
var
/
run
/
php
-
fpm
.
sock
;
fastcgi_param
SCRIPT_FILENAME
$
document_root
/
index
.
php
;
include
fastcgi_params
;
}
error_page
404
/
404
.
html
;
location
= /
404
.
html
{
root
/
var
/
www
/
errors
;
internal
;
}
location
^~ /
sad
.
svg
{
alias
/
var
/
www
/
errors
/
sad
.
svg
;
access_log
off
;
}
location
^~ /
twitter
.
svg
{
alias
/
var
/
www
/
errors
/
twitter
.
svg
;
access_log
off
;
}
location
^~ /
gitlab
.
svg
{
alias
/
var
/
www
/
errors
/
gitlab
.
svg
;
access_log
off
;
}
location
~* \.(
jpg
|
jpeg
|
gif
|
png
|
css
|
js
|
ico
|
webp
|
tiff
|
ttf
|
svg
)$ {
expires
5
d
;
}
# deny access to . files, for security
#
location
~ /\. {
log_not_found
off
;
deny
all
;
}
location
^~ /.
well
-
known
{
allow
all
;
auth_basic
off
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment