使用Nginx搭建图片服务器(windows)
知识点:在windows系统中,搭建图片上传服务器
参考博客:http://blog.csdn.net/u010942834/article/details/72953441
1.进入官网下载nginx压缩包,解压后目录如下
2.在解压后的conf/nginx.conf配置文件中,添加添加或者修改带有颜色地方的代码
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen ;
server_name localhost;
#charset utf-8;
#access_log logs/host.access.log main;
#添加博客的代码
location ~ .*\.(gif|jpg|jpeg|png)$ {
expires 24h;
root G:/images/;#指定图片存放路径
access_log G:/images/log;#图片路径
proxy_store on;
proxy_store_access user:rw group:rw all:rw;
proxy_temp_path G:/images/;#图片路径
proxy_redirect off;
proxy_set_header Host 127.0.0.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 1280k;
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
proxy_buffer_size 40k;
proxy_buffers 40 320k;
proxy_busy_buffers_size 640k;
proxy_temp_file_write_size 640k;
if ( !-e $request_filename)
{
proxy_pass http://169.254.140.133:8089; #代理访问地址
}
}
location / {
root 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 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;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
3.点击绿色的nginx.exe图标,启动服务器,在任务管理器看到如下,则启动成功
4.在浏览器中输入http://127.0.0.1:8089可以看到
5.在G:/images/下,放一个图片,在浏览器地址栏输入http://127.0.0.1:8089/img.jpg,就可以访问到服务器上的图片
使用Nginx搭建图片服务器(windows)的更多相关文章
- nginx 搭建图片服务器(windows 下,linux 下原理应该一样)
作者的心声:很多知道的.用过的东西,不写下来,下次还要百度查询,浪费时间和精力,故本次写下学习笔记,方便下次查阅. 题外话:如有读者通过我这篇博客解决了工作上的难题,可以给个评论,让我一起分享你的喜悦 ...
- Nginx,Nginx 搭建图片服务器
Nginx Nginx 概述 反向代理 工作流程 优点 1:保护了真实的web服务器,保证了web服务器的资源安全 2:节约了有限的IP地址资源 3:减少WEB服务器压力,提高响应速度 4:其他优点 ...
- Nginx 搭建图片服务器
Nginx 搭建图片服务器 本章内容通过Nginx 和 FTP 搭建图片服务器.在学习本章内容前,请确保您的Linux 系统已经安装了Nginx和Vsftpd. Nginx 安装:http://www ...
- Nginx搭建图片服务器
Nginx搭建图片服务器 标签(空格分隔): linux,nginx Nginx常用命令 ./nginx 启动 ./nginx -s reload 重载配置文件 ./nginx -s stop|sta ...
- nginx+ftp搭建图片服务器(Windows Server服务器环境下)
几种图片服务器的对比 1.直接使用ftp服务器,访问图片路径为 ftp://账户:密码@192.168.0.106/31275-105.jpg 不采用这种方式,不安全容易暴露ftp账户信息 2.直接使 ...
- ftp&nginx搭建图片服务器
下面使用ftp+nginx搭建一个简单的服务器 ftp用于文件的传输 nginx提供http服务 nginx服务器的安装和配置可以参照之前的教程:nginx安装及其配置详细教程 下面介绍ftp服务的安 ...
- 二、nginx搭建图片服务器
接上篇:Nginx安装手册 cd /usr/local/nginx/conf/ 配置图片服务器 方法一.在配置文件server{}中location /{} 修改配置: #默认请求 location ...
- ubuntu16.06+vsftpd+nginx搭建图片服务器
安装vsftpd 注:以下指令都在root账户下操作 # apt安装vsftpd apt-get install vsftpd #启动vsftpd service vsftpd start #新建用户 ...
- 【nginx】解决nginx搭建图片服务器访问图片404
图片通过ftp服务上传到/home/ftpuser/www/images目录下后访问 http://192.168.128.128/images/xxx.jpg 还是 404 NOT FOUND ,解 ...
随机推荐
- Win7环境下 IIS配置
一.介绍IIS Internet Information Services(IIS,互联网信息服务),是由微软公司提供的基于运行Microsoft Windows的互联网基本服务.最初是Windows ...
- 把www.domain.com均衡到本机不同的端口 反向代理 隐藏端口 Nginx做非80端口转发 搭建nginx反向代理用做内网域名转发 location 规则
负载均衡-Nginx中文文档 http://www.nginx.cn/doc/example/loadbanlance.html 负载均衡 一个简单的负载均衡的示例,把www.domain.com均衡 ...
- FROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)
w SELECT ro.*, FROM_UNIXTIME(ro.wstart,'%Y%m%d') FROM room_order ro
- Content-Negotiation Header Quality Values
HTTP: The Definitive Guide 17.3.2 Content-Negotiation Header Quality Values The HTTP protocol define ...
- php和jsCOOKIE实现前端交互
w如何精简? <script> document.cookie = 'wjs_cookie=' + 'amz_reviews'; function w(id) { document.coo ...
- 如何让thrift0.9.2 在macos上面编译通过?
为将来跨语言通信预研,选择了thrift来试试.结果在mac os上面安装遇到种种困难,不知道是我选择方法错误还是咋的,不管怎样,总算是编译过去了. 首先,我们来参考官网的安装步骤:https://t ...
- 基于flask的代码上传
from flask import Flask,Blueprint,request,render_template from flask import current_app as app from ...
- boost implicit_cast
在stackoverflow上看到这个帖子, 于是发现了boost::implicit_cast这个小东西. 先来看看这段代码: struct top {}; struct mid_a : top { ...
- Java io流详解四
转载地址:http://www.cnblogs.com/rollenholt/archive/2011/09/11/2173787.html 写在前面:本文章基本覆盖了java IO的全部内容,jav ...
- 修改WordPress标签云字体大小颜色及标签显示数量
WordPress 自带的标签云是一个很实用的小工具.站长可以通过标签对具有相同关健词的文章进行检索分类,利于访客查找相关文章.WordPress 默认标签云的字体最小为8pt,最大为22pt,标签显 ...