微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用宝塔面板 配置nginx 访问ftp服务器下面的图片

如果 你在服务器上 运行war项目 可以在tomcat 配置访问的:@H_404_1@

tomcat 也贴出来吧!@H_404_1@

 @H_404_1@

一.tomca配置访问,需要更改配置文件server.xml ,如果找不到,自己好好找一下  一般在 tomcat/conf 这个目录下面@H_404_1@

 @H_404_1@

1.@H_404_1@

截图:@H_404_1@

@H_404_1@@H_404_1@

 @H_404_1@

 2.

@H_404_1@@H_404_1@

 @H_404_1@

 3.找到 <Host></Host> 这个标签@H_404_1@

然后在<Host></Host>里添加<Context></>来实现映射功能

 @H_404_1@

 添加这一段:@H_404_1@

@H_404_1@@H_404_1@

 @H_404_1@

 直接放出来,你们可以复制@H_404_1@

 <Context path="/img" docBase="/img"  reloadable="true"></Context>

 @H_404_1@

然后就可以访问一下啦,图片访问成功@H_404_1@

 

@H_404_1@@H_404_1@

 @H_404_1@

 @H_404_1@

 @H_404_1@

二 .配置Nginx 访问ftp图片@H_404_1@

1:进入配置文件的目录:@H_404_1@

@H_404_1@@H_404_1@

 @H_404_1@

2;Nginx配置文件Nginx.config@H_404_1@

#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       80;
        server_name  localhost;

        #charset koi8-r;  

        #access_log  logs/host.access.log  main;  

        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;  
    #    }  
    #}  

}

三:配置图片服务器@H_404_1@

方法一、在配置文件server{}中location /{} 修改配置:@H_404_1@

   #认请求  
  location / {
     root  /home/ftpuser/www;#定义服务器的认网站根目录位置  
     index index.html index.PHP index.htm;#定义首页索引文件名称  
   }

 @H_404_1@

截图:@H_404_1@

@H_404_1@@H_404_1@

 @H_404_1@

测试:@H_404_1@

@H_404_1@@H_404_1@

 @H_404_1@

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐