Sign inSign up

choyri/nginx

By choyri

•Updated over 4 years ago

☘️ 自定义优化

Image
0

1.8K

choyri/nginx repository overview

⁠choyri/nginx

基于原生 nginx⁠,自定义优化。

⁠Feature

⁠Tip

  • /srv/
  • /etc/nginx/conf.d/
    • default.conf 默认主机
    • general.conf 综合配置项,供导入
    • security.conf 安全配置项,供导入
    • security_with_hsts.conf 带 HSTS 的安全配置项,供导入
  • /etc/nginx/conf.d/sites-enabled/
    • 站点目录

⁠Example

# docker-compose.yml

version: "3.8"

services:
  nginx:
    image: choyri/nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./conf:/etc/nginx/conf.d/sites-enabled:ro
      - ./ssl:/etc/nginx/ssl:ro
      - ./log:/var/log/nginx
      - ./srv:/srv
# /etc/nginx/conf.d/sites-enabled/example.com.conf

server {
    listen                  443 ssl http2;
    server_name             example.com;

    include                 /etc/nginx/conf.d/general.conf;
    include                 /etc/nginx/conf.d/security_with_hsts.conf;

    access_log              /var/log/nginx/example.com.access.log;
    error_log               /var/log/nginx/example.com.error.log warn;

    ssl_certificate         /etc/nginx/ssl/example.com.cer;
    ssl_certificate_key     /etc/nginx/ssl/example.com.key;
    ssl_trusted_certificate /etc/nginx/ssl/chain.pem;

    location / {
        root    /usr/share/nginx/html;
    }
}

server {
    listen      80;
    server_name example.com;

    location / {
        return 301 https://example.com$request_uri;
    }
}

Tag summary

Content type

Image

Digest

Size

14.3 MB

Last updated

over 4 years ago

docker pull choyri/nginx