Nginx搭建简易文件服务器

1.安装nginx,此处略过

2.修改nginx配置文件

详细如下

# 此处为部分文件是否有权限,使用root,则不会出现403权限问题
user root;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include 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 logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; server {
listen 80;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root html;
index index.html index.htm;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#}
# 显示目录
autoindex on;
# 显示大小
autoindex_exact_size on;
# 显示时间
autoindex_localtime on;
# 防止中文乱码
charset utf-8,gbk;
server {
listen 8080 default_server;
server_name _;
# root为需要展示的根目录
root /home/ts; location / { }
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}

重启nginx

./nginx -s reload

转载

https://blog.csdn.net/datadev_sh/article/details/83819791

Nginx搭建简易文件服务器的更多相关文章

  1. CentOS 6(64-bit) + Nginx搭建静态文件服务器

    Nginx搭建静态文件服务器 使用命令打开Nginx配置文件: sudo vim /etc/nginx/conf.d/default.conf 将配置改为: server { ...... ..... ...

  2. Ubuntu 14.04TLS Nginx搭建静态文件服务器

    Nginx搭建静态文件服务器 [官方教程]https://www.nginx.com/resources/admin-guide/serving-static-content/ 打开Nginx的配置文 ...

  3. nginx+ftp服务器搭建简易文件服务器

    在做一些小项目和学习项目过程中,学习了通过 nginx 和 FTP 搭建小型文件服务器,记录下: 1.环境 电脑:acer 操作系统:windows 10 ftp服务器 2.下载 nginx, 通过双 ...

  4. 使用nginx搭建简单文件服务器

    最近再做一个博客,本想使用fastdfs标准的文件存储服务器,但考虑到资源占用问题,且使用nginx比较快速,且效果不差.于是采用ngixn搭建. nginx搭建文件服务器,本质上就是nginx的静态 ...

  5. 基于nginx搭建简易的基于wcf集群的复杂均衡

    很多情况下基于wcf的复杂均衡都首选zookeeper,这样可以拥有更好的控制粒度,但zk对C# 不大友好,实现起来相对来说比较麻烦,实际情况下,如果 你的负载机制粒度很粗糙的话,优先使用nginx就 ...

  6. 使用vsftpd+nginx搭建一个文件服务器

    一:安装vsftpd 1.安装 [root@localhost jack]# yum -y install vsftpd 安装完后,有/etc/vsftpd/vsftpd.conf 文件,是vsftp ...

  7. Nginx之使用nginx搭建简单的文件服务器

    使用nginx可以搭建简单文件服务器 安装nginx(不详述) 修改配置文件 /usr/local/nginx/conf/nginx.conf user root; /usr/local/nginx/ ...

  8. 利用 Nginx 搭建小型的文件服务器

    利用 Nginx 搭建小型的文件服务器 1.查看 Nginx 配置 android@localhost:/etc/nginx/conf.d$ nginx -hnginx version: nginx/ ...

  9. 利用nginx搭建小型的文件服务器

    PS内的文件如果需要共享给其他计算机下载,可以选择ftp的方式,优点是操作性很高,修改删除下载等等都可以,但是速度略慢. 如果仅仅是将VPS作为文件中转站,可以尝试用Nginx架设一个简单的文件服务器 ...

随机推荐

  1. brew常用命令

    Homebrew 常用命令 brew -help # 查看帮助命令 brew config # 查看配置信息 brew list # 查看已安装软件包列表 brew cleanup # 清理所有包的旧 ...

  2. 关于vue.config.js 的 proxy 配置

    关于vue.config.js 的 proxy 配置有的同学不怎么明白项目里面有的配置了 pathRewrite 地址重写,有的又没有进行配置?/* * proxy代理配置的说明 * *接口例子:/z ...

  3. 每天一个 HTTP 状态码 前言

    前前言 在重新开始写博文(其实大多也就最多算是日常笔记小结)之际,就想着从短小精悍的文章入手,就想到了 HTTP 状态码.另外,记得很久之前,看过一个<每天一个 Linux 命令>系列文章 ...

  4. elementUI 输入框用户名和密码取消自动填充

    <!-- 用户名取消自动填充 autocomplete="off" --> <el-form-item label="用户名" prop=&q ...

  5. pandas:数据迭代、函数应用

    1.数据迭代 1.1 迭代行 (1)df.iterrows() for index, row in df[0:5].iterrows(): #需要两个变量承接数据 print(row) print(& ...

  6. synchronized真的很重么?

    synchronized 是java中常见的保证多线程访问共享资源时的安全的一个关键字.很多人在讲到synchronized 时都说synchronized 是一把重量级的锁,那么synchroniz ...

  7. django框架2

    内容概要 django小白必会三板斧 静态文件及相关配置 登录功能 静态文件 request对象方法 pycharm链接MySQL django链接MySQL django orm操作 django ...

  8. 【Azure 应用服务】NodeJS Express + MSAL 应用实现AAD登录并获取AccessToken -- cca.acquireTokenByCode(tokenRequest)

    问题描述 在上一篇博文 "[Azure 应用服务]NodeJS Express + MSAL 应用实现AAD集成登录并部署在App Service Linux环境中的实现步骤"中, ...

  9. HashMap高阶用法,十倍提升开发效率

    HashMap在工作中使用非常频繁,其实在JDK1.8的时候新增一些更高阶的用法,熟练使用这些方法可以大大提升开发效率,写出更简洁优美的代码. 1. get方法指定返回默认值(getOrDefault ...

  10. 使用PowerShell安装MySQL

    更新记录 2022年4月16日:本文迁移自Panda666原博客,原发布时间:2021年7月10日. 2022年4月16日:更新MySQL下载链接. 一.说明与准备工作 根据MySQL官网提供的安装M ...