nginx文件目录开启

将file.v2fy.com的解析到目标主机ip

以阿里云centos7为例

安装nginx

yum install nginx

修改文件 /etc/nginx/nginx.conf 配置

user  root;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
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;
    #tcp_nopush     on;

    keepalive_timeout  65;
    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 ;
    gzip_vary on;
    gzip_http_version 1.1;
    gzip_disable "MSIE [1-6]\.";
    include /etc/nginx/conf.d/*.conf;
}

修改文件 /etc/nginx/conf.d/file_v2fy.conf 配置

  • 首先新建 /share/zhaoolee 文件夹, 用于存放需要展示的文件
server {
    listen 80;
    server_name file.v2fy.com;
    charset utf-8;
    location / {
        alias /share/zhaoolee/;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
    }
}

重启nginx

systemctl restart nginx

搭建ftp, 并通过filezilla传文件到服务器 详细链接

查看file.v2fy.com效果

最终效果查看: http://file.v2fy.com

推荐阅读更多精彩内容