自由,分享
nginx的配置
#指定工作目录用户,这里不能是http用户,非则nginx下载功能不能用。
user sky;
worker_processes  1;
#开启错误日志
error_log  /var/log/nginx/error.log;
#在其他地方指定配置文件。方便管理
include /etc/nginx/conf.d/*.conf;

下面是sonic博客的nginx配置文件

upstream sonic {
  server 127.0.0.1:8080;
}
server {
        server_name     starting-point.cf;
        client_max_body_size 3024m;
	location /	 {
              proxy_pass http://127.0.0.1:8080;
              proxy_set_header HOST $host;
              proxy_set_header X-Forwarded-Proto $scheme;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}
	location /d/ {
              alias  /home/sky/downloadFile/;
              sendfile on;
              autoindex on;  # 开启目录文件列表
              autoindex_exact_size off;  # 显示出文件的确切大小,单位是bytes
              autoindex_localtime on;  # 显示的文件时间为文件的服务器时间
              charset utf-8,gbk;  # 避免中文乱码
         }
        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/starting-point.cf/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/starting-point.cf/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}


server {
    if ($host = starting-point.cf) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
        listen 80;
        server_name     starting-point.cf;
    return 404; # managed by Certbot
}