Skip to content

Commit 9860c5e

Browse files
committed
Update PHP version and NGINX config for more security
1 parent caae653 commit 9860c5e

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

Dockerrun.aws.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"containerDefinitions": [
1818
{
1919
"name": "wp",
20-
"image": "wordpress:php7.4-fpm-alpine",
20+
"image": "wordpress:php8.1-fpm-alpine",
2121
"essential": true,
2222
"environment": [
2323
{

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Oanh Nguyen <oanhnn.bk@gmail.com>
3+
Copyright (c) 2022 Oanh Nguyen <oanhnn.bk@gmail.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ If you would like to help take a look at the [list of issues](https://github.com
7575
## License
7676

7777
This project is released under the MIT License.
78-
Copyright © 2020 [Oanh Nguyen](https://github.com/oanhnn)
78+
Copyright © 2022 [Oanh Nguyen](https://github.com/oanhnn)
7979
Please see [License File](https://github.com/oanhnn/example-wordpress-with-docker/blob/master/LICENSE) for more information.

docker/nginx/default.conf

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,35 @@ upstream php-fpm {
33
}
44

55
server {
6+
server_name _;
67
listen 80 default_server;
78
listen [::]:80 default_server ipv6only=on;
89

10+
# logging
11+
access_log /var/log/nginx/access.log;
12+
error_log /var/log/nginx/error.log warn;
13+
server_tokens off;
14+
15+
# gzip for performance
16+
gzip on;
17+
gzip_vary on;
18+
gzip_proxied any;
19+
gzip_comp_level 6;
20+
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
21+
22+
## security headers
23+
# https://securityheaders.com/
24+
# https://scotthelme.co.uk/tag/security-headers/
25+
add_header X-Frame-Options "SAMEORIGIN" always;
26+
add_header X-XSS-Protection "1; mode=block" always;
27+
add_header X-Content-Type-Options "nosniff" always;
28+
add_header Referrer-Policy no-referrer;
29+
add_header Strict-Transport-Security "max-age=63072000" always;
30+
add_header Permissions-Policy "interest-cohort=()";
31+
932
root /var/www/html;
1033
index index.php index.html index.htm;
1134

12-
server_name _;
13-
server_tokens off;
14-
1535
location = /favicon.ico {
1636
log_not_found off;
1737
access_log off;

docker/wordpress/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM wordpress:php8.0-fpm-alpine
1+
FROM wordpress:php8.1-fpm-alpine
22

33
# Install xdebug and Less
44
RUN set -eux; \
@@ -19,4 +19,4 @@ RUN set -eux; \
1919
php --version
2020

2121
# Install WP-CLI
22-
COPY --from=wordpress:cli-php8.0 /usr/local/bin/wp /usr/local/bin/wp
22+
COPY --from=wordpress:cli-php8.1 /usr/local/bin/wp /usr/local/bin/wp

0 commit comments

Comments
 (0)