upstream tomcat { server tomcat:8080; } upstream ghost { server ghost:2368; } # HTTP server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; server_name ${NGINX_HOST}; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; root /app; index index.php index.jsp index.html index.htm; client_max_body_size 100M; location / { root /var/www/html; } ####### Proxies ####### # PHP proxy # location ~ \.php$ { # fastcgi_pass php:9001; # fastcgi_index index.php; # include php/fastcgi.conf; # root /app; # } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass php:9001; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } # Ghost proxy location /blog { proxy_pass http://ghost; proxy_set_header Host $http_host; # required for docker client's sake proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 900; } # Tomcat proxy location ~ \.jsp$ { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://tomcat; } }