Home > Backend Development > PHP Tutorial > Some problems with nginx configuration

Some problems with nginx configuration

WBOY
Release: 2016-07-28 08:25:37
Original
1064 people have browsed it

For work reasons, it is necessary to add the download function to the original nginx server. Add the server configuration in nginx.conf as follows:
The directory for downloading files is placed under download in the project root directory:
if ( $uri ~* "^/ download/.*" ) {
                                                                                                                            break; Then add a location that matches download. This location should be placed before matching all locations / .

location ~* "^/download/.*" {

                                                                                                    header Content-Type 'application/ OCTET-Stream; Charset = UTF-8 ';

Add_header Content-Transfer-encoding' Binary ';

error_page 404 http://weibo.com/sorry ;

}

Add_header Sponse head information.
After matching a location, the matching will not continue.

The above has introduced some issues with nginx configuration, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template