Skip to content

NGINX

NGINX 是由俄罗斯程序员 Igor Sysoev 开发的高性能 HTTP 和反向代理服务器,最初用于俄罗斯门户网站 Rambler 的需求; 2004 年以开源形式发布,采用 BSD 许可,后续由 NGINX, Inc. 公司维护并推出商业版本,广泛用于负载均衡、缓存和微服务架构。

安装

Custom the configuration file nginx.conf

shell
mkdir -p /d/etc/nginx/

sudo docker pull nginx:1.28
sudo docker run --rm --entrypoint=cat nginx:1.28 /etc/nginx/nginx.conf > /d/etc/nginx/nginx.conf

Start the container

shell
sudo docker run \
-d \
--restart unless-stopped \
--name ngx
-v /d/etc/nginx/nginx.conf:/etc/nginx/nginx.conf \
-v /path/to/my/content:/usr/share/nginx/html:ro \
nginx:1.28

常改配置

托管目录静态文件

nginx
server {
    location / {
        root /data/www;
    }

    location /images/ {
        root /data;
    }
}

Released under the CC-BY-NC-4.0