apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespase: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
version: v1
template:
metadata:
labels:
app: nginx
version: v1
spec:
containers:
- image: nginx
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
protocol: TCP
- containerPort: 443
protocol: TCP
volumeMounts:
- mountPath: /etc/nginx/conf.d
name: nginx-config
volumes:
- configMap:
defaultMode: 511
name: nginx-config
optional: false
name: nginx-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
namespase: nginx
data:
default.conf: "server {\n listen 80;\n listen [::]:80;\n server_name
\ localhost;\n \n #access_log /var/log/nginx/host.access.log main;\n root
\ /usr/share/nginx/html;\n index index.html index.htm;\n \n location /
{\n try_files $uri $uri/ @router;\n root /usr/share/nginx/html;\n
\ index index.html index.htm;\n }\n \n location @router {\n rewrite
^.*$ /index.html last;\n }\n \n #error_page 404 /404.html;\n
\n # redirect server error pages to the static page /50x.html\n #\n error_page
\ 500 502 503 504 /50x.html;\n location = /50x.html {\n root /usr/share/nginx/html;\n
\ }\n \n # proxy the PHP scripts to Apache listening on 127.0.0.1:80\n #\n
\ #location ~ \\.php$ {\n # proxy_pass http://127.0.0.1;\n #}\n \n
\ # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\n #\n
\ #location ~ \\.php$ {\n # root html;\n # fastcgi_pass
\ 127.0.0.1:9000;\n # fastcgi_index index.php;\n # fastcgi_param
\ SCRIPT_FILENAME /scripts$fastcgi_script_name;\n # include fastcgi_params;\n
\ #}\n \n # deny access to .htaccess files, if Apache's document root\n #
concurs with nginx's one\n #\n #location ~ /\\.ht {\n # deny all;\n
\ #}\n}"
k8s部署nginx
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 相關(guān)yaml和配置文件已上傳github,參考鏈接 https://github.com/fengshunli/k...
- 背景 ??團隊中做一個項目,使用Django開發(fā)多個應(yīng)用,如app1、app2等,均采用docker鏡像部署到k8...
- 1、準(zhǔn)備下面的配置文件,將該配置保存為文件名為:nginx.conf 的文件 /etc/nginx/certs/f...
- 準(zhǔn)備兩臺服務(wù)器 最低2核2g, 版本centos7.6master 公網(wǎng) 8.214.35.16 內(nèi)網(wǎng) ...