Nginx 反向代理配置及403出现原因

//image.happy.com.conf

server {

    //监听80端口

listen 80;

    //状态on,首页展现索引

    //状态off,首页403,不影响下层资源访问
    autoindex off;

    //image.happy.com

    server_name image.happy.com;

    //本地日志

    access_log d:/access.log combined;

index index.html index.htm index.jsp index.php;

    #error_page 404 /404.html;

    if ( $query_string ~* ".*[\;'\<\>].*" ){

return 404;

}

location ~ /(mmall_fe|mmall_admin_fe)/dist/view/* {

       deny all;

}

    location / {

    //目录转发

    root /ftpfile/img;

add_header Access-Control-Allow-Origin *;

}

location / {

    //端口转发

    //开启tomcat后,该站点转发到tomcat页面

    proxy_pass http://127.0.0.1:8080;

add_header Access-Control-Allow-Origin *;

}

}

评论

暂无评论