当前位置: 首页 > news >正文

搭建nginx图片服务器

(1)将图片存储于/home/data/images目录;
(2)配置nginx.conf


user  nginx;
worker_processes  4;error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;events {worker_connections  10000;
}http {include       /etc/nginx/mime.types;default_type  application/octet-stream;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;keepalive_timeout  65;#gzip  on;include /etc/nginx/conf.d/*.conf;autoindex on;
}

(3)配置default.conf

server {listen       80;listen  [::]:80;server_name  localhost;#access_log  /var/log/nginx/host.access.log  main;location / {root   /usr/share/nginx/html;index  index.html index.htm;}#error_page  404              /404.html;# redirect server error pages to the static page /50x.html#error_page   500 502 503 504  /50x.html;location = /50x.html {root   /usr/share/nginx/html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {#    proxy_pass   http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {#    root           html;#    fastcgi_pass   127.0.0.1:9000;#    fastcgi_index  index.php;#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;#    include        fastcgi_params;#}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {#    deny  all;#}location /status {stub_status on;}location /images {root /home/data;}
}

(4)测试

http://www.lryc.cn/news/288891.html

相关文章:

  • 大数据学习之Flink算子、了解DataStream API(基础篇一)
  • js中字符串string,遍历json/Object【匹配url、邮箱、电话,版本号,千位分割,判断回文】
  • 字符串和C预处理器
  • Ultraleap 3Di新建项目之给所有的Joint挂载物体
  • 关于session每次请求都会改变的问题
  • 【leetcode题解C++】150.逆波兰表达式求值 and 239.滑动窗口最大值 and 347.前k个高频元素
  • 【计网·湖科大·思科】实验三 总线型以太网的特性、集线器和交换机的区别、交换机的自学习算法
  • API设计模式:REST、GraphQL、gRPC与tRPC全面解析
  • C/C++ protobuf与json互转
  • Open CASCADE学习|圆柱螺旋线绘制原理探究
  • Python学习笔记--认识sys.argv
  • 【C++】入门基础
  • Nginx与keepalived实现集群
  • 初识MQRabbitMQ快速入门
  • javaMailSender 发送邮件,基于Spring Boot
  • 【汇总】解决Spring-Web与Spring-WebFlux冲突
  • maven 依赖配置补充
  • Pandas ------ 向 Excel 文件中写入含有合并表头的数据
  • kafka summary
  • 【新书推荐】2.6节 原码、反码和补码
  • docker 网络及如何资源(CPU/内存/磁盘)控制
  • 安装 nvm
  • Redis解决方案:NOAUTH Authentication required(连接jedis绑定密码或修改redis密码)
  • 多维时序 | Matlab实现WOA-TCN-Multihead-Attention鲸鱼算法优化时间卷积网络结合多头注意力机制多变量时间序列预测
  • 如何实现无公网IP实现远程访问MongoDB文件数据库
  • 华为防火墙USG6000V1的NAT实验
  • spark-flink设计思想之吸星大法-1
  • 力扣1312. 让字符串成为回文串的最少插入次数
  • qemu的安装
  • myql入门