Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- server_name YOUR_DOMAIN_NAME: example.com;
- location / { # Root goes to container 1
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_pass http://172.18.0.13:5000;
- auth_basic "Restricted Content";
- auth_basic_user_file /etc/nginx/.htpasswd;
- }
- location /api/ { # API goes to container 2
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_pass http://172.18.0.11:5000/api/;
- }
- location /api/v2/ { # API V2 goes to container 3
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_pass http://172.18.0.12/api/;
- # Micro caching
- #proxy_cache microcacheapi;
- #proxy_cache_valid 200 1s;
- #proxy_cache_use_stale updating;
- #proxy_cache_background_update on;
- #proxy_cache_lock on;
- }
- location /privacy { # Goes to www folder to get some static page
- root /var/www/example.com;
- index privacy.html index.htm index.html;
- try_files $uri $uri.html $uri/ =404;
- }
- # pass PHP scripts to FastCGI server
- #
- #location ~ \.php$ {
- # include snippets/fastcgi-php.conf;
- #
- # # With php-fpm (or other unix sockets):
- # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
- # # With php-cgi (or other tcp sockets):
- # fastcgi_pass 127.0.0.1:9000;
- #}
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- #
- #location ~ /\.ht {
- # deny all;
- #}
- listen [::]:443 ssl http2 ipv6only=on; # managed by Certbot
- listen 443 ssl http2; # managed by Certbot
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement