Nginx启动关闭和重启、文档直接下载不阅览

nginx启动相关

启动:sbin/nginx -c conf/nginx.conf

关闭:sbin/nginx -s stop

重启(重新加载配置文件):sbin/nginx -s reload

检测配置文件:sbin/nginx -t

nginx配置doc、xlsx等直接下载

 1 server {
 2     listen 80;
 3     server_name nginx.src;
 4 
 5     location / {
 6         root /home/ftp;
 7         if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$){
 9                 add_header Content-Disposition: 'attachment;';
10        }
11        #index index.html;
12 }            

猜你喜欢

转载自www.cnblogs.com/webyyq/p/9118765.html
今日推荐