Skip to content

Commit aaaa33c

Browse files
committed
Improving nginx configuration
1 parent 2adfc19 commit aaaa33c

File tree

4 files changed

+85
-13
lines changed

4 files changed

+85
-13
lines changed

configs/nginx/conf.d/default.conf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
upstream php {
2+
server wp_server:9000;
3+
}
4+
5+
server {
6+
7+
root /www;
8+
index index.php;
9+
10+
location = /favicon.ico {
11+
log_not_found off;
12+
access_log off;
13+
}
14+
15+
location = /robots.txt {
16+
allow all;
17+
log_not_found off;
18+
access_log off;
19+
}
20+
21+
location / {
22+
23+
try_files $uri $uri/ /index.php?$args;
24+
}
25+
26+
location ~ \.php$ {
27+
28+
include fastcgi.conf;
29+
fastcgi_intercept_errors on;
30+
fastcgi_pass wp_server:9000;
31+
}
32+
33+
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
34+
expires max;
35+
log_not_found off;
36+
}
37+
}

configs/nginx/conf/nginx.conf

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
worker_processes 1;
2+
3+
daemon off;
4+
5+
events {
6+
worker_connections 1024;
7+
}
8+
9+
error_log /var/log/nginx/error.log warn;
10+
pid /var/run/nginx.pid;
11+
12+
http {
13+
include /etc/nginx/conf/mime.types;
14+
default_type application/octet-stream;
15+
16+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
17+
'$status $body_bytes_sent "$http_referer" '
18+
'"$http_user_agent" "$http_x_forwarded_for"';
19+
20+
access_log /var/log/nginx/access.log main;
21+
22+
sendfile on;
23+
#tcp_nopush on;
24+
25+
keepalive_timeout 65;
26+
27+
gzip on;
28+
gzip_disable "msie6";
29+
30+
gzip_vary on;
31+
gzip_proxied any;
32+
gzip_comp_level 6;
33+
gzip_buffers 16 8k;
34+
gzip_http_version 1.1;
35+
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
36+
# tells the server to use on-the-fly gzip compression.
37+
client_max_body_size 64M;
38+
include /etc/nginx/conf.d/*.conf;
39+
40+
41+
}
42+

configs/nginx/nginx.conf

Lines changed: 0 additions & 10 deletions
This file was deleted.

docker-compose.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ services:
88
restart: always
99
ports:
1010
- "80:80"
11+
- 443:443
1112
volumes:
1213
- ./www/wp_files/:/www:ro
13-
- ./configs/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
14+
- ./configs/nginx/conf/nginx.conf:/etc/nginx/conf/nginx.conf:ro
15+
- ./configs/nginx/conf.d:/etc/nginx/conf.d:ro
16+
1417
links:
1518
- wp_server
1619

1720
wp_server:
18-
build:
21+
build:
1922
context: ./docker-images/php/
2023
args:
2124
PHP_VERSION: 7.1
@@ -25,7 +28,7 @@ services:
2528
container_name: wp_server
2629
volumes:
2730
- ./www/wp_files/:/www
28-
# - ./php/:/usr/local/etc/php/conf.d/
31+
- ./configs/php/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
2932
links:
3033
- wp_mariadb
3134

0 commit comments

Comments
 (0)