: This article mainly introduces [nginx] how to download statistics files (flask). For more information about PHP tutorials, see.
One requirement is whether the statistical file is completely downloaded by the user. because it is a web application, the implementation scheme is not found in js, so the nginx implementation scheme is searched and the simple exploration process is recorded.
Lab 1
The original idea is to check the log. after downloading a file, we can check whether the file size
, and then let the static server handle the download.This requires the use of the Sendfile mechanism: "The traditional Web server when processing file downloads, always read the contents of the file into the application memory, and then send the contents of the memory to the client browser." This approach will consume more server resources in response to today's heavy-duty web sites. Sendfile is a high-performance network IO mode supported by modern operating system, the Sendfile call of the ope
continuation of the breakpoint and the edge-to-bottom broadcast of the video fileThe best way is through the header (' X-accel-redirect:/xxx/aa.mp4 ') access, X-accel-redirect support Content-range and HTTP 206,apache inside is X-sendfileIf you can not configure nginx internal option, or Nginx does not support X-accel-redirect, but to use the breakpoint continua
;anyYou can specify that any response code be cachedFastcgi_cache_valid 302 10m;fastcgi_cache_valid 301 1h;fastcgi_cache_valid any 1m;The cached parameters can also be set directly in the response header. These have precedence over the cache time setting using the directive
The "X-accel-expires" header field sets caching time of a response in seconds. The zero value disables caching for a response. If The value starts @ with the pre
. If improperly configured, the user may download to a 0-byte file.
Using X-sendfile will allow downloads of files in non-web directories, such as/root/, to be downloaded even if the files are not accessed under. htaccess protection.
Different Web servers implement different HTTP headers
SENDFILE Head
the WEB device used
X-sendfile
Apache, Lighttpd v1.5, Cherokee
X-lighttpd-send-file
LIGHTTPD v1.4
X-
position of this option = position of the previous option line + Maximum menu item width
this["line" +i].targetpos = this["line" + (i-1)].targetpos+max_h;
}
The width of no active menu item will decrease
else {
The line target of this option = position of the previous option line + Minimum menu item width
this["line" +i].targetpos = this["line" + (i-1)].targetpos+min_h;
}
The following two lines are the elastic algorithm of the line, this algorithm is very similar, where applied to the flexibil
//External call for vehicle Movement control function Public void Move(floatSteering,floatAccelfloatFootbrake,floatHandbrake) {Debug.Log ("***************************: "+ Footbrake +" "+ handbrake);//Keep the current tyre mesh following wheelcollider rotation for(inti =0; I 4; i++) {quaternion quat; Vector3 position; M_wheelcolliders[i]. Getworldpose ( outPosition outQuat); M_wheelmeshes[i].transform.position = position;
There is a requirement is whether the statistical files are fully downloaded by the user, because it is a Web application, with JS did not find the implementation of the scheme, so search the implementation of Nginx, the simple exploration process recorded.
Experiment One
The original idea, look at the log, after downloading a file, we look at the log transfer file size is consistent with the original size of the file
Test the size of the file to be downloaded
Lo
Speaking of access permission control, many of them read nginx-related
Article Friends will naturally think of the X-accel-redirect header. This header has a defect, that is, all access requests will first pass through a FastCGI to determine the permission. In the download system, this method is very suitable, but on the image server with a very large access volume, simply using this method will make a large number of images without permission judgme
general static file download is not through PHP, directly from the Web server sent to the client. But sometimes need to implement the file download permissions control, and so on, need to pass the PHP program to do permission verification. The simple and rude approach is to verify the permissions in the PHP program, and then read the contents of the file before sending it to the client. This approach does satisfy the requirements, but it is clear that sending static file content from PHP is far
Trojan file in the registry and delete the key.
Bobo v1.0-2.0Clear Trojan v1.0Open Registry RegeditClick Directory to:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunDelete Dirrectlibrarysupport on the right = "C:\WINDOWS\SYSTEM\Dllclient.exe"Turn off regedit and restart the computer.DEL C:\Windows\System\Dllclient.exeOk
Clear Trojan v2.0Open Registry RegeditClick Directory to:hkey_user/. Default/software/mirabilis/icq/agent/apps/icq accel
-dns--enable-basic-auth-helpers= "NCSA"--enable-stacktrace--with-large-files--disable-mempools--with-filedescriptors=65536--enable-ssl--enable-x-accelerator-varMakeMake installMake Install-pinger
3. Configure Squid
The code is as follows
Copy Code
Cp/usr/local/squid/etc/squid.conf/usr/local/squid/etc/squid.conf.old>/usr/local/squid/etc/squid.confLn-s/usr/local/squid/etc/squid.conf/etc/squid.conf
Contents of squid.conf:
The code is as fo
the forwarding.11, Proxy caching function, is still relatively simple, looking forward to12, get the client IP and forward to the background, compared with squid x_forwarded_for13, background server can be returned by X-accel-redirect response header to control the download14, on the implementation of the proxy error page jump15, support the judgment expression, expecting the expression of the operation, so that the configuration file can become a la
directory to: HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Run Delete dirrectlibrarysupport = "C: \ WINDOWS \ SYSTEM \ dllclient.exe "Close regedit and restart the computer. Del C: \ WINDOWS \ SYSTEM \ dllclient.exe OK clear Trojan V2.0 open registry Regedit click directory to: hkey_user /. default/software/Mirabilis/ICQ/agent/apps/ICQ accel is an "hypothetical" primary key. Select the primary key of ICQ
. d/squid reload
6.3 add iptables rules to redirect internal HTTP requests to port 3128
A. Start the iptables service.
#/Etc/init. d/iptables start
B. Clear existing iptables filter table rules
# Iptables-F
C. Save iptables settings
#/Etc/init. d/iptables save
D. View NAT table settings
# Iptables-T nat-l-N
E. Add a rule to the NAT table.
# Iptables-T nat-I prerouting-I eth0-s 192.168.1.0/24-P TCP -- dport 80-J redirect -- to-port 3128
F. Save
G. Set iptables to boot
# Chkconfig iptables o
Nginx uses the XSendfile module to allow php to download files faster. In practice, nginx uses the XSendfile module to allow php to download files faster.
Https://www.markdream.com/technologies/programs/nginx-x-accel-redirect-php-practise.shtml? Utm_source = tuicool utm_medium = referralIntroduction
It's a bit of time recently. [email protected]After PHP enables faster file downloads, it is necessary to optimize the attachment download function in
1. Add source and get key
EnterSudo gedit/etc/APT/sources. List
Add the following source
Http://ubuntu.beryl-project.org/feisty main
Get key
Wget http://ubuntu.beryl-project.org/root@lupine.me.uk.gpg-o-| sudo apt-key add-
Update
Sudo apt-Get update
2. Download related software
System-> System Management-> New Software Package Manager, search and mark the installation of the following software packagesXserver-xgl
Emerald-themes
Beryl
Beryl-Manager
3. Make xgl runSudo gedit/usr/bin/startxg
Add t
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.