rancher 离线安装nginx
Last updated on November 22, 2024 pm
🧙 Questions
离线安装nginx
☄️ Ideas
资源下载
docker pull --platform=linux/amd64 nginx:1.27.0
docker save -o /Users/ispong/OneDrive/Downloads/docker/nginx-1.27.0-amd64.tar nginx:1.27.0
导入镜像
需要资源找我要
scp /Users/ispong/OneDrive/Downloads/dockernginx-1.27.0-amd64.tar root@47.92.37.247:/tmp
docker load -i /tmp/nginx-1.27.0-amd64.tar
docker tag nginx:1.27.0 isxcode:8443/library/nginx:1.27.0
docker push isxcode:8443/library/nginx:1.27.0
创建目录
mkdir -p /data/nginx
测试网页
tee -a /data/nginx/html/index.html <<-'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body>
hello world
</body>
</html>
EOF
默认配置文件
vim /data/nginx/conf/default.conf
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
创建department
Container Name: isxcode-nginx
Image: docker.io/library/nginx:1.27.0
Pull Policy: IfNotPresent
Pull Secrets: local-harbor
端口号
Service Type: Node Port
Name: nginx-port
Private Container Port: 80
Protocol: TCP
Listening: 30103
挂载磁盘
Mount Point -> Sub Path in Volume
/usr/share/nginx/html -> html
/etc/nginx/conf.d -> conf
🔗 Links
rancher 离线安装nginx
https://ispong.isxcode.com/kubernetes/rancher/rancher 离线安装nginx/