FTP+Nginx图片服务器(整合)

来源:互联网 发布:舒乐安定 淘宝 编辑:程序博客网 时间:2024/06/05 19:15


其实就是配置nginx.config

nginx的访问路径配置成sftp存放资源的路径

 

一开始有可能启动成功但是nginx不能访问,这时候我们关闭下linux的防火墙

防火墙有firewalliptables两种,你看看是哪个关了就行,当然或者配置下防火墙的端口也可以

nginx.config/usr/local/nginx/conf

 

更改完了先停止nginx然后在根据conf启动,详见上篇博客,下面是配置信息


user  root;worker_processes  1;worker_rlimit_nofile 65535;#error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {    worker_connections  12040;}http {    include       mime.types;    default_type  application/octet-stream;#Proxy_cache_path    /data/sftp/usersftp/upload levels=1:2  keys_zone=cache_one:200m inactive=1d max_size=30g;    #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       8088;        server_name  localhost;        #charset koi8-r;        #access_log  logs/host.access.log  main;        location / {            root   html;            index  index.html index.htm;#proxy_pass http://192.168.10.223:1234;        }        #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       7788;        server_name  localhost;#    ssl on;    #    ssl_certificate      /usr/local/nginx/conf/server.crt;    #    ssl_certificate_key  /usr/local/nginx/conf/server_nopwd.key;charset utf-8;#charset koi8-r;location ~ (\.jsp)|(\.do)/ {proxy_pass http://127.0.0.1:7001;proxy_set_header X-Real-IP $remote_addr;proxy_set_header Host $host;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_buffer_size 4k;proxy_buffers 4 32k;proxy_busy_buffers_size 64k;proxy_temp_file_write_size 64k;proxy_max_temp_file_size 512m;      }    }server {listen 8888;server_name localhost;charset utf-8;location ~ .*\.(gif|jpg|jpeg|png){#allow 127.0.0.1;#deny all;#expires 24h;root /data/sftp/usersftp/upload;access_log /usr/local/nginx/NginxTestImgLog/log_test.log;proxy_store on;proxy_store_access user:rw group:rw all:rw;proxy_redirect    off;proxy_set_header  Host $host;proxy_set_header  X-Real-IP $remote_addr;proxy_set_header  X-Forwarded-For $remote_addr;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          1024k;proxy_buffers              40 1024k;proxy_busy_buffers_size    1024k;proxy_temp_file_write_size 1024k;proxy_temp_path    /usr/local/nginx/nginxTestImg/;#Proxy_cache_path /nginxTestImg/;if ( !-e $request_filename){proxy_pass http://127.0.0.1:8888;}}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;}}}

下篇博客就是从html利用表单提交到springMVC 到controller到service然后到sftp



0 0
原创粉丝点击