Browse Source

Apply suggested changes

pull/97/head
zeke 3 months ago
parent
commit
39412b4427
  1. 1
      docker-compose.yml
  2. 104
      docker/nginx/leftypol.conf
  3. 36
      docker/nginx/nginx.conf
  4. 11
      docker/php/custom.ini
  5. 9
      docker/php/www.conf

1
docker-compose.yml

@ -24,7 +24,6 @@ services:
dockerfile: ./docker/php/Dockerfile dockerfile: ./docker/php/Dockerfile
volumes: volumes:
- ./:/code - ./:/code
- ./docker/php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
- ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf - ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf
networks: networks:
leftchan_net: leftchan_net:

104
docker/nginx/leftypol.conf

@ -1,68 +1,66 @@
upstream php-upstream { upstream php-upstream {
server php:9000; server php:9000;
} }
server { server {
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server ipv6only=on; listen [::]:80 default_server ipv6only=on;
server_name leftypol; server_name leftypol;
root /var/www-leftypol; root /var/www-leftypol;
add_header X-Frame-Options "SAMEORIGIN"; add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff"; add_header X-Content-Type-Options "nosniff";
index index.html index.php; index index.html index.php;
charset utf-8; charset utf-8;
location ~ ^([^.\?]*[^\/])$ { location ~ ^([^.\?]*[^\/])$ {
try_files $uri @addslash; try_files $uri @addslash;
} }
# Expire rules for static content # Expire rules for static content
# Media: images, icons, video, audio, HTC # Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M; expires 1M;
access_log off; access_log off;
log_not_found off; log_not_found off;
add_header Cache-Control "public"; add_header Cache-Control "public";
} }
# CSS and Javascript # CSS and Javascript
location ~* \.(?:css|js)$ { location ~* \.(?:css|js)$ {
expires 1y; expires 1y;
access_log off; access_log off;
log_not_found off; log_not_found off;
add_header Cache-Control "public"; add_header Cache-Control "public";
} }
location ~* \.(html)$ { location ~* \.(html)$ {
expires -1; expires -1;
} }
location @addslash { location @addslash {
return 301 $uri/; return 301 $uri/;
} }
location / { location / {
try_files $uri $uri/ /index.php$is_args$args; try_files $uri $uri/ /index.php$is_args$args;
} }
client_max_body_size 2G; client_max_body_size 2G;
location ~ \.php$ { location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Request-Id $x_request_id; proxy_set_header X-Request-Id $x_request_id;
proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Host $host;
proxy_set_header Forwarded-Request-Id $x_request_id; proxy_set_header Forwarded-Request-Id $x_request_id;
fastcgi_pass php-upstream; fastcgi_pass php-upstream;
fastcgi_index index.php; fastcgi_index index.php;
fastcgi_buffers 16 16k; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_buffer_size 32k; fastcgi_read_timeout 600;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; include fastcgi_params;
fastcgi_read_timeout 600; }
include fastcgi_params;
}
location = /favicon.ico { access_log off; log_not_found off; } location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; }
} }

36
docker/nginx/nginx.conf

@ -2,32 +2,32 @@
# https://github.com/dead-guru/devichan/blob/master/nginx/nginx.conf # https://github.com/dead-guru/devichan/blob/master/nginx/nginx.conf
user leftypol; user leftypol;
worker_processes 4; worker_processes auto;
# daemon off; # daemon off;
# error_log /var/log/nginx/error.log warn; # error_log /var/log/nginx/error.log warn;
error_log /dev/stdout warn; error_log /dev/stdout warn;
pid /var/run/nginx.pid; pid /var/run/nginx.pid;
events { events {
worker_connections 1024; worker_connections 1024;
} }
http { http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
#access_log /var/log/nginx/access.log; #access_log /var/log/nginx/access.log;
# Switch logging to console out to view via Docker # Switch logging to console out to view via Docker
access_log /dev/stdout; access_log /dev/stdout;
error_log /dev/stdout warn; error_log /dev/stdout warn;
sendfile on; sendfile on;
keepalive_timeout 5; keepalive_timeout 5;
gzip on; gzip on;
gzip_http_version 1.0; gzip_http_version 1.0;
gzip_vary on; gzip_vary on;
gzip_comp_level 6; gzip_comp_level 6;
gzip_types text/xml text/plain text/css application/xhtml+xml application/xml application/rss+xml application/atom_xml application/x-javascript application/x-httpd-php; gzip_types text/xml text/plain text/css application/xhtml+xml application/xml application/rss+xml application/atom_xml application/x-javascript application/x-httpd-php;
gzip_disable "MSIE [1-6]\."; gzip_disable "MSIE [1-6]\.";
include /etc/nginx/conf.d/*.conf; include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-available/*.conf; include /etc/nginx/sites-available/*.conf;
} }

11
docker/php/custom.ini

@ -1,11 +0,0 @@
; based on https://github.com/dead-guru/devichan/blob/master/php-fpm/custom.ini
memory_limit = 2G
max_execution_time = 30
upload_max_filesize = 2G
post_max_size = 2G
pm = dynamic
pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 10

9
docker/php/www.conf

@ -2,9 +2,8 @@
user = leftypol user = leftypol
group = leftypol group = leftypol
listen = 127.0.0.1:9000 listen = 127.0.0.1:9000
pm = dynamic pm = static
pm.max_children = 200 pm.max_children = 16
pm.start_servers = 10 pm.start_servers = 2
pm.min_spare_servers = 1 pm.min_spare_servers = 1
pm.max_spare_servers = 20 pm.max_spare_servers = 3
pm.max_requests = 20000

Loading…
Cancel
Save