nginx 鏡像中文字符集使用詳解
一. nginx 鏡像中文字符集
1. Dockerfile
基于 Debian 12 的nginx鏡像,默認(rèn)不支持中文字符集,制作鏡像讓其中文文件不顯示亂碼, locale-gen "en-US.UTF-8" "zh-CN.UTF-8"
FROM nginx:latest RUN sed -i 's#http://deb.debian.org#https://mirrors.163.com#g' /etc/apt/sources.list && apt-get update && apt-get install locales -y && sed -i 's/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/g' /etc/locale.gen && locale-gen ENV LC_ALL zh_CN.UTF-8 ENV LANG zh_CN.UTF-8
docker build . -t harbor.uuf.net.cn/library/nginx:ch-cn
2. Deploy
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: nginx-warehouse namespace: nokf spec: storageClassName: managed-nfs-storage accessModes: - ReadWriteMany resources: requests: storage: 1Gi
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-warehouse namespace: nokf spec: replicas: 1 selector: matchLabels: app: nginx-warehouse template: metadata: labels: app: nginx-warehouse spec: containers: - name: nginx-warehouse image: harbor.uuf.net.cn/library/nginx:ch-cn imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /etc/nginx/conf.d/ name: nginx-warehouse - mountPath: /home/nginx-warehouse name: storage volumes: - name: nginx-warehouse configMap: name: nginx-warehouse - name: storage persistentVolumeClaim: claimName: nginx-warehouse --- apiVersion: v1 kind: Service metadata: name: nginx-warehouse namespace: nokf spec: type: ClusterIP ports: - port: 80 selector: app: nginx-warehouse --- kind: ConfigMap apiVersion: v1 metadata: name: nginx-warehouse namespace: nokf data: default.conf: |- server { listen 80; location / { autoindex on; charset utf-8; # 必要的 root /home/nginx-warehouse/; } }
以上就是nginx 鏡像中文字符集使用詳解的詳細(xì)內(nèi)容,更多關(guān)于nginx 鏡像中文字符集的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
Nginx同一個(gè)域名配置多個(gè)項(xiàng)目的實(shí)現(xiàn)方法
這篇文章主要介紹了Nginx同一個(gè)域名配置多個(gè)項(xiàng)目的實(shí)現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-03-03nginx添加nginx-sticky-module模塊步驟的實(shí)現(xiàn)
nginx-sticky-module模塊是nginx實(shí)現(xiàn)負(fù)載均衡的一種方案,和ip_hash負(fù)載均衡算法會(huì)有區(qū)別的,本文主要介紹了nginx添加nginx-sticky-module模塊步驟的實(shí)現(xiàn),感興趣的可以了解一下2023-08-08Nginx 啟動(dòng)、停止、重啟、升級(jí)操作命令收集
也許你不知道什么是Nginx,Nginx是一個(gè)WEB服務(wù)器,如IIS那樣,現(xiàn)在好多門戶都在使用了Nginx作為WEB服務(wù)器了,Nginx在Linux系統(tǒng)下跑很優(yōu)秀,強(qiáng)過其它的WEB服務(wù)端,還可以做負(fù)載均衡,很不錯(cuò)吧。2010-10-10Nginx報(bào):Nginx?-?504?Gateway?Time-out問題解決辦法
這篇文章主要給大家介紹了關(guān)于Nginx報(bào):Nginx?-?504?Gateway?Time-out問題的解決辦法,一般是由于程序執(zhí)行時(shí)間過長(zhǎng)導(dǎo)致響應(yīng)超時(shí),例如程序需要執(zhí)行90秒,而nginx最大響應(yīng)等待時(shí)間為30秒,這樣就會(huì)出現(xiàn)超時(shí),需要的朋友可以參考下2024-01-01詳解Nginx 出現(xiàn) 403 Forbidden 的解決辦法
本篇文章主要介紹了詳解Nginx 出現(xiàn) 403 Forbidden 的解決辦法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-08-08Nginx默認(rèn)location?index設(shè)置網(wǎng)站的默認(rèn)首頁方法詳解
我們都知道index后面可以跟多個(gè)設(shè)置,如果訪問的時(shí)候沒有指定具體訪問的資源,則會(huì)依次進(jìn)行查找,找到第一個(gè)為止,這篇文章主要給大家介紹了關(guān)于Nginx默認(rèn)location?index設(shè)置網(wǎng)站的默認(rèn)首頁的相關(guān)資料,需要的朋友可以參考下2023-12-12使用Nginx實(shí)現(xiàn)根據(jù) IP 匹配指定 URL
最近的一個(gè)項(xiàng)目,需要特定的IP訪問某專題頁面的時(shí)候跳轉(zhuǎn)到網(wǎng)站首頁,思考了下,直接使用NGINX實(shí)現(xiàn),分享給大家。2014-09-09