First, install nginx
yum install -y nginx
Second, modify the configuration file /etc/nginx/nginx.conf
user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; 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; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; file application default_type / OCTET-Stream; . # Modular Configuration Files from the Load The Directory /etc/nginx/conf.d # See http://nginx.org/en/docs/ngx_core_module.html#include . # for More Information the include / etc / Nginx / the conf.d / * the conf;. Server { the listen the default_server 80; the listen [::]: 80 the default_server; server_name _; # The default for the Load Configuration Server Block Files. the include /etc/nginx/default.d/ .conf *; location / { root /usr/share/nginx/html/download; autoindex on; #开启索引功能 autoindex_exact_size off; # File Close calculates the exact size (in bytes), show approximate size (kB, MB, GB) autoindex_localtime ON; # shows the machine rather than in GMT time } error_page 404 /404.html; LOCATION = / 40X {.html } error_page 500 502 503 504 /50x.html; LOCATION /50x.html = { } } }
Third, create a download path / usr / share / nginx / html / download
mkdir -p /usr/share/nginx/html/download
Fourth, upload files and authorize 755
Fifth, the browser opens ngixn address will be happy to download! ! !