Created
August 30, 2016 17:16
-
-
Save iameli/650c125d8e6ac43d030fafd05c46bd5a to your computer and use it in GitHub Desktop.
Just a cool way to run a customized nginx from one file in Kubernetes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: extensions/v1beta1 | |
| kind: Deployment | |
| metadata: | |
| name: cachet | |
| namespace: csats-com | |
| spec: | |
| template: | |
| metadata: | |
| labels: | |
| app: cachet | |
| spec: | |
| volumes: | |
| - name: nginx-config | |
| configMap: | |
| name: nginx-config | |
| containers: | |
| - image: nginx:stable-alpine | |
| name: nginx-config | |
| volumeMounts: | |
| - name: nginx-config | |
| mountPath: /etc/nginx/conf.d | |
| --- | |
| kind: ConfigMap | |
| apiVersion: v1 | |
| metadata: | |
| name: nginx-config | |
| namespace: csats-com | |
| data: | |
| default.conf: |- | |
| server { | |
| listen 80 default; ## Listen for ipv4; this line is default and implied | |
| # Make site accessible from http://localhost/ | |
| server_name localhost; | |
| root /var/www/html/public; | |
| index index.html index.htm index.php; | |
| charset utf-8; | |
| location / { | |
| try_files $uri $uri/ /index.php?$query_string; | |
| } | |
| # Cache images | |
| location ~* .(jpg|jpeg|png|gif|ico|css|js|ttf)$ { | |
| expires 365d; | |
| } | |
| # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
| location ~ \.php$ { | |
| fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
| include fastcgi_params; | |
| fastcgi_pass localhost:9000; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| fastcgi_index index.php; | |
| fastcgi_keep_conn on; | |
| } | |
| location ~ /\.ht { | |
| deny all; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment