Nginx 配置文件上传与下载配置文件上传与下载
最近在做项目中需要给前端提供文件下载链接,所以借着机会搭建了基于Nginx的文件服务器,特此记录便于日后查阅。
1、配置文件、配置文件
需要修改 nginx.conf 配置文件(内网地址:10.12.1.215、外网地址:113.98.58.42),内容如下:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
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;
proxy_request_buffering off;
proxy_buffering off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 9010;
server_name localhost;
charset utf-8;
include /etc/nginx/default.d/*.conf;
location / {
root /usr/local/oas/file;
sendfile on;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
client_max_body_size 500M;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
root /usr/share/nginx/html/PaaS/;
try_files $uri /index.html;
index index.html;
}
location /ts/api {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://10.12.1.206:31001/;
# proxy_cookie_path / /ts/api;
}
location /ts/others {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://10.12.1.206:31001/others;
}
location /oas-cloud {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://10.12.1.215:30103/oas-cloud;
}
location /zuul {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://10.12.1.215:30103/zuul;
}
location /tengine {
proxy_pass http://127.0.0.1:8080/;
}
location /uum {
proxy_pass http://127.0.0.1:8081/;
}
评论10