Nginx中:
server {
listen 80; #端口
server_name fota.localhost.com; #服务名
location /download {
#add_header Content-Disposition: 'attachment;'; #打开点击文件自动下载
client_max_body_size 100m; #上传文件大小限制
autoindex on; #是否允许网页上查看,开启索引功能
root D:\SVN\file; #显示的根索引目录
autoindex_exact_size off; #关闭计算文件确切大小(单位bytes),只显示大概大小(单位kb、mb、gb)
autoindex_localtime on; #显示本机时间而非 GMT 时间
}
location / {
proxy_pass http://192.168.2.166:20001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
}
}
Apache配置:
<VirtualHost *:80>
ServerName fota.neoway.com
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow From All
</Directory>
ProxyRequests off
ProxyPreserveHost On
<Proxy *>
Order allow,deny
Allow from all
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
</Proxy>
#ProxyPass /fota/api/ http://127.0.0.1:8381/fota/api/
#ProxyPassReverse /fota/api/ http://127.0.0.1:8381/fota/api/
#ProxyPass /api/v1/ http://127.0.0.1:10010/api/v1/
#ProxyPassReverse /api/v1/ http://127.0.0.1:10010/api/v1/
ProxyPassMatch ^((?!/upload/).)*$ http://neoway.cc:5081/
</VirtualHost>