一元网络论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 31|回复: 0

Docker 部署 Nginx 时,配置文件 nginx.conf 中引用 conf.d 目录下的 default.conf 文件失效。

[复制链接]

3万

主题

3万

帖子

9万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
94523
发表于 2024-11-11 21:59:53 | 显示全部楼层 |阅读模式
```
user  nginx;  
worker_processes  auto;  
error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;  
events {
    worker_connections  1024;  
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;  
    sendfile        on;  
    client_max_body_size 100M;
    tcp_nopush     on;  
    tcp_nodelay    on;  
    keepalive_timeout  65;
    types_hash_max_size  2048;
    gzip on;
    gzip_min_length 1k;
    gzip_comp_level 2;
        gzip_types text/plain
                application/javascript
                application/x-javascript
                text/css
                application/xml
                text/javascript
                application/x-httpd-php
                image/jpeg
                image/gif
                image/png;
        gzip_vary on;  
    include /etc/nginx/conf.d/*.conf;  
    server {
        listen       80;  
        server_name  localhost;  
        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        error_page  404              /404.html;  
        location = /404.html {
            internal;
        }
        error_page   500 502 503 504  /50x.html;  
        location = /50x.html {
            internal;
        }
    }
}
server {
    listen 80;
    listen [::]:80;
    server_name xx.cn;  
   
    return 301 https://$server_name$request_uri;
}
server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name xx.cn;

  
    ssl_certificate xxx.pem;     
    ssl_certificate_key xx.key;  

    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_session_tickets off;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305HE-RSA-AES128-GCM-SHA256HE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;

    location /blog/ {
        proxy_pass http://localhost:11102/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
    }

    location /status/ {
        proxy_pass http://localhost:3001/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location = /favicon.ico {
        access_log off;
        log_not_found off;
    }
        
        location /files/ {
                charset utf-8;
                #allow 124.64.18.162;
                #deny all;                                               
                root /home/meta/;
                autoindex on;
        }
    # 错误页面配置
    error_page 404 /404.html;
    location = /404.html {
        internal;
    }
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        internal;
    }
}
```
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|一元网络论坛

GMT+8, 2024-11-23 15:43 , Processed in 0.094112 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表