In Nginx:
server { listen 80; #port server_name fota.localhost.com; #Service name location /download { #add_header Content-Disposition: 'attachment;'; #Open and click the file to download automatically client_max_body_size 100m; #Upload file size limit autoindex on; #Whether to allow viewing on web pages and enable indexing root D:\SVN\file; #Displayed root index directory autoindex_exact_size off; #Close the calculation of the exact size of the file (in bytes), only display the approximate size (in kb, mb, gb) autoindex_localtime on; #Display local time instead of GMT time } 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 configuration:
<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>