CentOS uses Nginx to build a download function server

This article mainly introduces CentOS using Nginx to build a download function server. Friends who need it can refer to

Use nginx to build a download function on the server,

Install Nginx, pcre
mkdir /usr/local/nginx
tar zxvf pcre-8.12.tar.gz
cd pcre-8.12
. /configure --prefix=/usr/local/pcre
make && make install
tar zxvf nginx-1.0.12.tar.gz

tar zxvf nginx-1.0.12.tar.gz
cd nginx-1.0.12
. /configure --prefix=/usr/local/nginx/ --with-pcre=/opt/pcre-8.12
make && make install
vi /usr/local/nginx/conf/nginx.conf

# user www www;worker_processes 8;error_log /usr/local/nginx/logs/error.log crit;pid /usr/local/nginx/logs/nginx.pid; worker_cpu_affinity 0000000100000010000001000000100000010000001000000100000010000000;worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200;} http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 8m; access_log off; sendfile on; tcp_nodelay on; tcp_nopush on; keepalive_timeout 30; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 32k; fastcgi_buffers 8 32k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; open_file_cache max=51200 inactive=20s; open_file_cache_valid 30s; open_file_cache_min_uses 1; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; #if you modify nginx source,please hidden follow #server_tokens off; log_format access '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" $http_x_forwarded_for'; include /usr/local/nginx/conf/vhost/*.conf;}

Virtual host configuration

mkdir /usr/local/nginx/conf/vhost
cd /usr/local/nginx/conf/vhost
vi hosts.conf

server { listen 80; server_name 42.62.XX. index index.html index.htm index.php; root /game/; error_page 502=/502.html; location ~*^/upload/.*\.(php|php5)$ { deny all;}# location ~.*\.(php|php5)?$ {# #fastcgi_pass unix:/tmp/php-cgi.sock;# fastcgi_pass 127.0.0.1:9000;# fastcgi_index index.php;# include fastcgi.conf;# } location ~.*\.(gif|jpg|jpeg|png|bmp|swf|mp3)$ { expires 30d;} location ~.*\.(js|css)?$ { expires 12h;}#access_log /data/webroot/nginx/logs/access.log access;#error_log /data/webroot/nginx/logs/error.log error;}

/usr/local/nginx/sbin/nginx -t

nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful

/usr/local/nginx/sbin/nginx -s reload

At this time, create a /game directory on the server, and put the resources that need to be downloaded in the directory.

Recommended Posts

CentOS uses Nginx to build a download function server
How to quickly build Nginx server under CentOS
Centos7 tutorial to build a master-slave DNS server
Centos8 implementation steps to build a local web server
Centos7 uses vim to build powerful pyt
(1) Centos7 installation to build a cluster environment
How to build a LAMP environment on centos7.2
3 minutes to teach you to build gitea on Centos server
Use Rancher to build a K8s cluster under CentOS7
Build OpenV** Server under CentOS7
Build OpenLDAP server under CentOS7
Install Nginx server on CentOS 7
Teach you how to build a Git server on Ubuntu
Detailed steps to set up a Git server on CentOS
CentOS8.1 build Gitlab server detailed tutorial
Build a PXC cluster under CentOS8
Centos8 uses Docker to deploy a detailed tutorial for Django projects
How to install Nginx on CentOS 8
Centos8 uses Apache httpd2.4.37 to install web server steps in detail
Centos6 method steps to build gitlab
Build an FTP server under centos7
How to set up the Nginx server configuration block on CentOS 8
Build Nginx environment on Linux (CentOS)
(centos7) linux build nginx load balancing build
Centos7 build java web server tomcat
Build a file server on ubuntu
Modify CentOS server time to Beijing time
Centos7 deploys HAproxy to implement Nginx cluster
[PHP] Build a PHP operating environment under CentOS
Centos8 uses yum to install mongodb 4.2 method
Centos7 uses yum to install pip, ipython
Build a Minecraft Bedrock Edition server (Ubuntu)
How to monitor CentOS 7 server with Prometheus
How to change the CentOS server time to Beijing time
Build Nginx based on Centos 7 (including virtual host)
Build a ScaleIO distributed storage cluster under CentOS7
Python3 development environment to build a detailed tutorial
Configure Nginx to start automatically based on CentOS 7
Centos7 uses LVM to achieve dynamic expansion method
How to modify the CentOS server time to Beijing time
Centos7.2 compile and install way to build phpMyAdmin