Optimize nginx configuration

master
Nikola Forró 5 years ago
parent 2b4c1b4c08
commit 53ee6b2b53

@ -1,7 +1,7 @@
user nginx lilia; user nginx lilia;
worker_processes 1; worker_processes 1;
error_log /var/log/nginx/error.log warn; error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid; pid /var/run/nginx.pid;
@ -14,25 +14,13 @@ http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' access_log off;
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on; sendfile on;
tcp_nodelay on;
tcp_nopush on; tcp_nopush on;
keepalive_timeout 65; keepalive_timeout 65;
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
server { server {
listen 80; listen 80;
server_name localhost; server_name localhost;
@ -43,6 +31,12 @@ http {
try_files $uri $uri/ /index.php?$query_string; try_files $uri $uri/ /index.php?$query_string;
} }
location ~* ^/.+\.(?:jpg|jpeg|gif|png|ico|cur|mp4|ogg|ogv|webm|htc|xml|eot|woff|woff2|ttf|svg|otf)$ {
root /app;
expires 1M;
add_header Cache-Control public;
}
location ~ ^/.+\.php$ { location ~ ^/.+\.php$ {
root /app; root /app;
index index.php; index index.php;
@ -91,8 +85,7 @@ http {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1; proxy_http_version 1.1;
tcp_nodelay on; proxy_pass http://horde-members-api:5000;
proxy_pass http://horde-members-api:5000/;
} }
location ^~ /instagram/api/ { location ^~ /instagram/api/ {
@ -100,8 +93,7 @@ http {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1; proxy_http_version 1.1;
tcp_nodelay on; proxy_pass http://instagram-api:5000;
proxy_pass http://instagram-api:5000/;
} }
location ^~ /quotes/api/ { location ^~ /quotes/api/ {
@ -109,8 +101,7 @@ http {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1; proxy_http_version 1.1;
tcp_nodelay on; proxy_pass http://quotes-api:5000;
proxy_pass http://quotes-api:5000/;
} }
location ^~ /teespring/api/ { location ^~ /teespring/api/ {
@ -118,8 +109,7 @@ http {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1; proxy_http_version 1.1;
tcp_nodelay on; proxy_pass http://teespring-api:5000;
proxy_pass http://teespring-api:5000/;
} }
location ^~ /twitch-cache/api/ { location ^~ /twitch-cache/api/ {
@ -127,8 +117,7 @@ http {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1; proxy_http_version 1.1;
tcp_nodelay on; proxy_pass http://twitch-cache-api:5000;
proxy_pass http://twitch-cache-api:5000/;
} }
location ^~ /twitch-subs/api/ { location ^~ /twitch-subs/api/ {
@ -136,8 +125,7 @@ http {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1; proxy_http_version 1.1;
tcp_nodelay on; proxy_pass http://twitch-subs-api:5000;
proxy_pass http://twitch-subs-api:5000/;
} }
location ^~ /schedule { location ^~ /schedule {

Loading…
Cancel
Save